-
Notifications
You must be signed in to change notification settings - Fork 6
/
WISEFEE_SCHEMA.txt
286 lines (255 loc) · 8 KB
/
WISEFEE_SCHEMA.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
CREATE TABLE ADDRESS (
ADDR_ID BIGINT NOT NULL AUTO_INCREMENT,
LOCATION VARCHAR(100) NOT NULL,
ADDRESS_NAME VARCHAR(200) NOT NULL,
ADDRESS_DETAIL VARCHAR(300) NOT NULL,
ZIP_CODE VARCHAR(30) NULL,
LNG INT NULL,
LAT INT NULL,
PREFER_LOCATION VARCHAR(50) NULL,
CREATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
UPDATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (ADDR_ID)
);
CREATE TABLE SUBSCRIBE (
SUB_ID BIGINT NOT NULL AUTO_INCREMENT,
SUBTCT_ID BIGINT NOT NULL,
PAYMENT_ID BIGINT NOT NULL,
MEMBER_ID BIGINT NOT NULL,
CAFE_ID BIGINT NOT NULL,
TOTAL_PRICE INT NULL,
SUB_COMMENT VARCHAR(3000) NULL,
SUB_TYPE VARCHAR(100) NOT NULL,
SUB_PEOPLE INT NOT NULL,
CREATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
UPDATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (SUB_ID, SUBTCT_ID, PAYMENT_ID)
);
CREATE TABLE CAFE (
CAFE_ID BIGINT NOT NULL AUTO_INCREMENT,
MEMBER_ID BIGINT NOT NULL,
ADDR_ID BIGINT NOT NULL,
TITLE VARCHAR(255) NOT NULL,
CONTENT VARCHAR(255) NULL,
CAFE_PHONE VARCHAR(20) NOT NULL,
FILE_ID BIGINT NOT NULL,
CREATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
UPDATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (CAFE_ID, MEMBER_ID, ADDR_ID)
);
CREATE TABLE PAYMENT (
PAYMENT_ID BIGINT NOT NULL AUTO_INCREMENT,
PAYMENT_PRICE INT NOT NULL,
PAYMENT_INFO VARCHAR(1000) NOT NULL,
CREATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (PAYMENT_ID)
);
CREATE TABLE CART (
CART_ID BIGINT NOT NULL AUTO_INCREMENT,
MEMBER_ID INT NOT NULL,
CAFE_ID BIGINT NOT NULL,
CAFE_QUANTITY INT NOT NULL,
CART_STATUS VARCHAR(1) NOT NULL,
CREATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
UPDATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (CART_ID)
);
CREATE TABLE NOTIFICATIONS (
NOTIFICATION_ID BIGINT NOT NULL AUTO_INCREMENT,
MEMBER_ID BIGINT NOT NULL,
NOTIFICATION_MESSAGE VARCHAR(2000) NOT NULL,
NOTIFICATION_STATUS VARCHAR(1) NOT NULL,
NOTIFICATION_TYPE VARCHAR(30) NOT NULL,
REFERENCE_ID VARCHAR(50) NULL,
CAFE_ID BIGINT NOT NULL,
CREATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
UPDATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (NOTIFICATION_ID, MEMBER_ID)
);
CREATE TABLE ORDERS (
ORDER_ID BIGINT NOT NULL AUTO_INCREMENT,
SUB_ID BIGINT NOT NULL,
PAYMENT_ID BIGINT NOT NULL,
TUMBLR_STATUS VARCHAR(1) NOT NULL,
PRODUCT_RECEIVE_TIME DATETIME NULL,
PRODUCT_STATUS VARCHAR(30) NOT NULL,
CREATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
UPDATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (ORDER_ID, SUB_ID, PAYMENT_ID)
);
CREATE TABLE PRODUCT (
PRODUCT_ID BIGINT NOT NULL AUTO_INCREMENT,
CAFE_ID BIGINT NOT NULL,
PRODUCT_NAME VARCHAR(100) NOT NULL,
PRODUCT_PRICE INT NOT NULL,
PRODUCT_INFO VARCHAR(2000) NULL,
CREATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
UPDATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (PRODUCT_ID)
);
CREATE TABLE ORDER_PRODUCT (
ORDER_PRODUCT_ID BIGINT NOT NULL AUTO_INCREMENT,
ORDER_ID BIGINT NOT NULL,
PRODUCT_ID BIGINT NOT NULL,
PAYMENT_PRICE BIGINT NOT NULL,
PRIMARY KEY(ORDER_PRODUCT_ID)
);
CREATE TABLE FILE (
FILE_ID BIGINT NOT NULL AUTO_INCREMENT,
FILE_TYPE VARCHAR(50) NOT NULL,
NAME VARCHAR(255) NOT NULL,
FILE_CAPACITY VARCHAR(10) NOT NULL,
FILE_PATH VARCHAR(500) NOT NULL,
MEMBER_ID BIGINT NOT NULL,
IS_DELETED BOOLEAN NOT NULL,
FILE_INFO VARCHAR(1000) NULL,
CREATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
UPDATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (FILE_ID)
);
CREATE TABLE PRODUCT_IMAGE (
PRODUCT_IMAGE_ID BIGINT NOT NULL AUTO_INCREMENT,
PRODUCT_ID BIGINT NOT NULL,
FILE_ID BIGINT NOT NULL,
PRIMARY KEY(PRODUCT_IMAGE_ID, PRODUCT_ID, FILE_ID)
);
CREATE TABLE MEMBER (
MEMBER_ID BIGINT NOT NULL AUTO_INCREMENT,
NICKNAME VARCHAR(100) NOT NULL,
EMAIL VARCHAR(150) NOT NULL,
PHONE VARCHAR(20) NOT NULL,
PHONE_OFFICE VARCHAR(20) NULL,
BIRTH VARCHAR(10) NOT NULL,
PASSWORD VARCHAR(100) NOT NULL,
ACCOUNT_TYPE VARCHAR(1) NOT NULL,
AUTH_TYPE VARCHAR(50) NOT NULL,
IS_AUTH_EMAIL VARCHAR(1) NOT NULL,
IS_ALLOW_PUSH_MSG VARCHAR(1) NOT NULL,
PUSH_MSG_TOKEN VARCHAR(500) NOT NULL,
MEMBER_STATUS VARCHAR(1) NOT NULL,
2FE1 VARCHAR(1) NULL,
ADDR_ID BIGINT NOT NULL,
CREATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
UPDATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (MEMBER_ID)
);
CREATE TABLE SUBTICKET_TYPE (
SUBTCT_ID BIGINT NOT NULL AUTO_INCREMENT,
SUBTCT_NAME VARCHAR(50) NOT NULL,
SUBTCT_PRICE INT NOT NULL,
SUBTCT_MIN_USER_CNT INT NOT NULL,
SUBTCT_MAX_USER_CNT INT NOT NULL,
SUBTCT_DEPOSIT INT NOT NULL,
SUBTCT_BASE_DISCNT_RATE INT NOT NULL,
SUBTCT_ADT_DISCNT_RATE INT NOT NULL,
SUBTCT_MAX_DISCNT_RATE INT NOT NULL,
SUBTCT_DESC TEXT NULL,
CREATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
UPDATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (SUBTCT_ID)
);
CREATE TABLE PRODUCT_OPTION (
PRD_OPTION_ID BIGINT NOT NULL AUTO_INCREMENT,
PRODUCT_ID BIGINT NOT NULL,
PRD_OPTION_NAME VARCHAR(50) NOT NULL,
CREATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
UPDATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (PRD_OPTION_ID, PRODUCT_ID)
);
CREATE TABLE PRODUCT_OPT_CHOICE (
PRD_OPTCHOICE_ID BIGINT NOT NULL AUTO_INCREMENT,
PRD_OPTION_ID BIGINT NOT NULL,
PRD_OPTCHOICE_NAME VARCHAR(50) NOT NULL,
PRD_OPTCHOICE_PRICE INT NOT NULL,
CREATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
UPDATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (PRD_OPTCHOICE_ID, PRD_OPTION_ID)
);
CREATE TABLE ORDER_OPTION (
ORDER_OPTION_ID BIGINT NOT NULL AUTO_INCREMENT,
ORDER_ID BIGINT NOT NULL,
CAFE_ID BIGINT NOT NULL,
ORDER_OPTION_NAME VARCHAR(50) NOT NULL,
ORDER_OPTION_PRICE INT NOT NULL,
CREATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
UPDATED_AT DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (ORDER_OPTION_ID, ORDER_ID, CAFE_ID)
);
ALTER TABLE SUBSCRIBE ADD CONSTRAINT FK_SUBTICKET_TYPE_TO_SUBSCRIBE_1 FOREIGN KEY (
SUBTCT_ID
)
REFERENCES SUBTICKET_TYPE (
SUBTCT_ID
);
ALTER TABLE SUBSCRIBE ADD CONSTRAINT FK_PAYMENT_TO_SUBSCRIBE_1 FOREIGN KEY (
PAYMENT_ID
)
REFERENCES PAYMENT (
PAYMENT_ID
);
ALTER TABLE CAFE ADD CONSTRAINT FK_MEMBER_TO_CAFE_1 FOREIGN KEY (
MEMBER_ID
)
REFERENCES MEMBER (
MEMBER_ID
);
ALTER TABLE CAFE ADD CONSTRAINT FK_ADDRESS_TO_CAFE_1 FOREIGN KEY (
ADDR_ID
)
REFERENCES ADDRESS (
ADDR_ID
);
ALTER TABLE NOTIFICATIONS ADD CONSTRAINT FK_MEMBER_TO_NOTIFICATIONS_1 FOREIGN KEY (
MEMBER_ID
)
REFERENCES MEMBER (
MEMBER_ID
);
ALTER TABLE ORDERS ADD CONSTRAINT FK_SUBSCRIBE_TO_ORDERS_1 FOREIGN KEY (
SUB_ID
)
REFERENCES SUBSCRIBE (
SUB_ID
);
ALTER TABLE ORDERS ADD CONSTRAINT FK_PAYMENT_TO_ORDERS_1 FOREIGN KEY (
PAYMENT_ID
)
REFERENCES PAYMENT (
PAYMENT_ID
);
ALTER TABLE PRODUCT_IMAGE ADD CONSTRAINT FK_PRODUCT_TO_PRODUCT_IMAGE_1 FOREIGN KEY (
PRODUCT_ID
)
REFERENCES PRODUCT (
PRODUCT_ID
);
ALTER TABLE PRODUCT_IMAGE ADD CONSTRAINT FK_FILE_TO_PRODUCT_IMAGE_1 FOREIGN KEY (
FILE_ID
)
REFERENCES FILE (
FILE_ID
);
ALTER TABLE PRODUCT_OPTION ADD CONSTRAINT FK_PRODUCT_TO_PRODUCT_OPTION_1 FOREIGN KEY (
PRODUCT_ID
)
REFERENCES PRODUCT (
PRODUCT_ID
);
ALTER TABLE PRODUCT_OPT_CHOICE ADD CONSTRAINT FK_PRODUCT_OPTION_TO_PRODUCT_OPT_CHOICE_1 FOREIGN KEY (
PRD_OPTION_ID
)
REFERENCES PRODUCT_OPTION (
PRD_OPTION_ID
);
ALTER TABLE ORDER_OPTION ADD CONSTRAINT FK_ORDER_TO_ORDER_OPTION_1 FOREIGN KEY (
ORDER_ID
)
REFERENCES ORDERS (
ORDER_ID
);
ALTER TABLE ORDER_OPTION ADD CONSTRAINT FK_CAFE_TO_ORDER_OPTION_1 FOREIGN KEY (
CAFE_ID
)
REFERENCES CAFE (
CAFE_ID
);