修改数据库sql
This commit is contained in:
72
database.sql
72
database.sql
@@ -82,7 +82,7 @@ create table article_comments
|
|||||||
articleId bigint not null comment '对应的文评ID',
|
articleId bigint not null comment '对应的文评ID',
|
||||||
user_id varchar(40) not null comment '对应的用户ID',
|
user_id varchar(40) not null comment '对应的用户ID',
|
||||||
parent_id int null comment '关联本表的 id,用于回复功能。 如果为 0 或 NULL,则为顶级评论。',
|
parent_id int null comment '关联本表的 id,用于回复功能。 如果为 0 或 NULL,则为顶级评论。',
|
||||||
content int not null comment '具体评论',
|
content text not null comment '具体评论',
|
||||||
created_time datetime not null comment '评论创建时间',
|
created_time datetime not null comment '评论创建时间',
|
||||||
update_time datetime not null comment '更新时间',
|
update_time datetime not null comment '更新时间',
|
||||||
likes_count int default 0 not null comment '点赞数量',
|
likes_count int default 0 not null comment '点赞数量',
|
||||||
@@ -177,20 +177,84 @@ create table referral_codes
|
|||||||
id int auto_increment comment '内推码Id'
|
id int auto_increment comment '内推码Id'
|
||||||
primary key,
|
primary key,
|
||||||
code int not null comment '内推码',
|
code int not null comment '内推码',
|
||||||
articleId bigint not null comment '内推文评',
|
|
||||||
created_by varchar(40) not null comment '创建者ID',
|
created_by varchar(40) not null comment '创建者ID',
|
||||||
valid_until datetime not null comment '有效期',
|
valid_until datetime not null comment '有效期',
|
||||||
uses_num int not null comment '使用次数',
|
uses_num int not null comment '使用次数',
|
||||||
create_time datetime not null comment '创建时间',
|
create_time datetime not null comment '创建时间',
|
||||||
constraint referral_codes_pk_2
|
constraint referral_codes_pk_2
|
||||||
unique (code),
|
unique (code),
|
||||||
constraint referral_codes_article_list_articleId_fk
|
|
||||||
foreign key (articleId) references article_list (articleId),
|
|
||||||
constraint referral_codes_user_info_uid_fk
|
constraint referral_codes_user_info_uid_fk
|
||||||
foreign key (created_by) references user_info (uid)
|
foreign key (created_by) references user_info (uid)
|
||||||
)
|
)
|
||||||
comment '内推码表';
|
comment '内推码表';
|
||||||
|
|
||||||
|
create table lottery_campaigns
|
||||||
|
(
|
||||||
|
id int auto_increment comment '活动id'
|
||||||
|
primary key,
|
||||||
|
name varchar(255) not null comment '活动名称',
|
||||||
|
description text null comment '活动描述',
|
||||||
|
referral_code_id int not null comment '内推码id',
|
||||||
|
start_time datetime not null comment '活动开始时间',
|
||||||
|
end_time datetime not null comment '活动结束时间',
|
||||||
|
is_ended int not null comment '活动是否结束,1:结束,2:未结束',
|
||||||
|
created_time datetime not null comment '创建时间',
|
||||||
|
update_time datetime not null comment '更新时间',
|
||||||
|
max_lottery_per_user int default 1 not null comment '每个用户的最大抽奖次数',
|
||||||
|
constraint lottery_campaigns_referral_codes_id_fk
|
||||||
|
foreign key (referral_code_id) references referral_codes (id)
|
||||||
|
)
|
||||||
|
comment '抽奖活动表';
|
||||||
|
|
||||||
|
create table lottery_prizes
|
||||||
|
(
|
||||||
|
id int auto_increment comment '奖项id'
|
||||||
|
primary key,
|
||||||
|
campaign_id int not null comment '关联活动ID',
|
||||||
|
name varchar(255) not null comment '奖项名称',
|
||||||
|
image_url varchar(255) not null comment '奖项图片URL',
|
||||||
|
probability float not null comment '奖项中奖概率',
|
||||||
|
max_wins int not null comment '最大中奖次数',
|
||||||
|
current_wins int default 0 not null comment '当前中奖人数',
|
||||||
|
create_time datetime not null comment '创建时间',
|
||||||
|
update_time datetime not null comment '更新时间',
|
||||||
|
constraint lottery_prizes_lottery_campaigns_id_fk
|
||||||
|
foreign key (campaign_id) references lottery_campaigns (id)
|
||||||
|
)
|
||||||
|
comment '抽奖奖项表';
|
||||||
|
|
||||||
|
create table lottery_records
|
||||||
|
(
|
||||||
|
id int auto_increment comment '记录ID'
|
||||||
|
primary key,
|
||||||
|
user_id varchar(40) not null comment '抽奖用户ID',
|
||||||
|
campaign_id int not null comment '关联活动ID',
|
||||||
|
referral_code_id int not null,
|
||||||
|
prize_id int not null comment '中奖选项ID',
|
||||||
|
is_win int not null comment '是否中奖,1:中奖,2:未中奖',
|
||||||
|
create_time datetime not null comment '抽奖时间',
|
||||||
|
constraint lottery_records_lottery_campaigns_id_fk
|
||||||
|
foreign key (campaign_id) references lottery_campaigns (id),
|
||||||
|
constraint lottery_records_lottery_prizes_id_fk
|
||||||
|
foreign key (prize_id) references lottery_prizes (id),
|
||||||
|
constraint lottery_records_referral_codes_id_fk
|
||||||
|
foreign key (referral_code_id) references referral_codes (id)
|
||||||
|
)
|
||||||
|
comment '抽奖记录表';
|
||||||
|
|
||||||
|
create table referral_code_bindings
|
||||||
|
(
|
||||||
|
id int auto_increment comment '关联记录ID'
|
||||||
|
primary key,
|
||||||
|
code_id int not null comment '关联内推码ID',
|
||||||
|
entity_type varchar(50) not null comment '业务类型',
|
||||||
|
entity_id int not null comment '关联实体ID',
|
||||||
|
create_time datetime not null comment '创建时间',
|
||||||
|
constraint referral_code_bindings_referral_codes_id_fk
|
||||||
|
foreign key (code_id) references referral_codes (id)
|
||||||
|
)
|
||||||
|
comment '内推码业务关联表';
|
||||||
|
|
||||||
create table user_msg
|
create table user_msg
|
||||||
(
|
(
|
||||||
sender_id varchar(30) not null,
|
sender_id varchar(30) not null,
|
||||||
|
|||||||
Reference in New Issue
Block a user