create_tables.sql
7.74 KB
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
CREATE TABLE IF NOT EXISTS "market_activity" (
"id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"title" varchar(50) NOT NULL,
"activity_type" tinyint(4) NOT NULL,
"status" tinyint(4) NOT NULL,
"start_time" datetime NOT NULL,
"end_time" datetime NOT NULL,
"invalid_time" datetime,
"delete_time" datetime,
"time_limited_discount" varchar(2000),
"full_privilege" varchar(2000),
"creator" varchar(64) DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar(64) DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint(20) NOT NULL,
PRIMARY KEY ("id")
) COMMENT '促销活动';
CREATE TABLE IF NOT EXISTS "promotion_coupon_template" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"name" varchar NOT NULL,
"status" int NOT NULL,
"total_count" int NOT NULL,
"take_limit_count" int NOT NULL,
"take_type" int NOT NULL,
"use_price" int NOT NULL,
"product_scope" int NOT NULL,
"product_spu_ids" varchar,
"validity_type" int NOT NULL,
"valid_start_time" datetime,
"valid_end_time" datetime,
"fixed_start_term" int,
"fixed_end_term" int,
"discount_type" int NOT NULL,
"discount_percent" int,
"discount_price" int,
"discount_limit_price" int,
"take_count" int NOT NULL DEFAULT 0,
"use_count" int NOT NULL DEFAULT 0,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
PRIMARY KEY ("id")
) COMMENT '优惠劵模板';
CREATE TABLE IF NOT EXISTS "promotion_coupon" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"template_id" bigint NOT NULL,
"name" varchar NOT NULL,
"status" int NOT NULL,
"user_id" bigint NOT NULL,
"take_type" int NOT NULL,
"useprice" int NOT NULL,
"valid_start_time" datetime NOT NULL,
"valid_end_time" datetime NOT NULL,
"product_scope" int NOT NULL,
"product_spu_ids" varchar,
"discount_type" int NOT NULL,
"discount_percent" int,
"discount_price" int,
"discount_limit_price" int,
"use_order_id" bigint,
"use_time" datetime,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
PRIMARY KEY ("id")
) COMMENT '优惠劵';
CREATE TABLE IF NOT EXISTS "promotion_reward_activity" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"name" varchar NOT NULL,
"status" int NOT NULL,
"start_time" datetime NOT NULL,
"end_time" datetime NOT NULL,
"remark" varchar,
"condition_type" int NOT NULL,
"product_scope" int NOT NULL,
"product_spu_ids" varchar,
"rules" varchar,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
PRIMARY KEY ("id")
) COMMENT '满减送活动';
CREATE TABLE IF NOT EXISTS "promotion_discount_activity" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"name" varchar NOT NULL,
"status" int NOT NULL,
"start_time" datetime NOT NULL,
"end_time" datetime NOT NULL,
"remark" varchar,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
PRIMARY KEY ("id")
) COMMENT '限时折扣活动';
CREATE TABLE IF NOT EXISTS "promotion_discount_product" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"activity_id" bigint NOT NULL,
"spu_id" bigint NOT NULL,
"sku_id" bigint NOT NULL,
"discount_type" int NOT NULL,
"discount_percent"
int,
"discount_price"
int,
"creator"
varchar
DEFAULT
'',
"create_time"
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP,
"updater"
varchar
DEFAULT
'',
"update_time"
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP,
"deleted"
bit
NOT
NULL
DEFAULT
FALSE,
PRIMARY
KEY
(
"id"
)
) COMMENT '限时折扣活动';
CREATE TABLE IF NOT EXISTS "promotion_seckill_config"
(
"id"
bigint
NOT
NULL
GENERATED
BY
DEFAULT AS
IDENTITY,
"name"
varchar
NOT
NULL,
"start_time"
varchar
NOT
NULL,
"end_time"
varchar
NOT
NULL,
"seckill_activity_count"
int
NOT
NULL,
"pic_url"
varchar
NOT
NULL,
"status"
varchar
NOT
NULL,
"creator"
varchar
DEFAULT
'',
"create_time"
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP,
"updater"
varchar
DEFAULT
'',
"update_time"
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP,
"deleted"
bit
NOT
NULL
DEFAULT
FALSE,
"tenant_id"
bigint
NOT
NULL,
PRIMARY
KEY
(
"id"
)
) COMMENT '秒杀时段配置';