54 lines
3.6 KiB
SQL
54 lines
3.6 KiB
SQL
-- ----------------------------
|
|
-- Title:动态表
|
|
-- Author:0fun
|
|
-- Table:lc_subjects
|
|
-- ---------------------------
|
|
drop table if exists lc_subjects;
|
|
create table lc_subjects(
|
|
id int unsigned not null auto_increment comment '自增id',
|
|
app_id int unsigned not null default 1 comment '小程序ID',
|
|
app_uid int unsigned not null comment '用户id',
|
|
title varchar(32) not null default '' comment '标题',
|
|
cover text comment '封面(多图用逗号隔开,包含图片信息)',
|
|
imgs text comment '图片信息(多图用逗号隔开,包含图片信息)',
|
|
content text not null comment '内容',
|
|
cate_id int(10) unsigned not null default '0' comment '图片信息',
|
|
biz_id int(10) unsigned not null default '0' comment '商家id',
|
|
address varchar(255) not null default '' comment '定位地址',
|
|
lat double(15,12) not null default '0.000000000000' comment '经度',
|
|
lng double(15,12) not null default '0.000000000000' comment '纬度',
|
|
zan_num int unsigned not null default 0 comment '点赞数',
|
|
fav_num int unsigned not null default 0 comment '收藏数',
|
|
share_num int unsigned not null default 0 comment '分享数',
|
|
status tinyint(1) not null default 1 comment '状态:-1删除,0禁用,1正常',
|
|
top tinyint(1) not null default 0 comment '0正常,1置顶',
|
|
c_time int unsigned not null default 0 comment '创建时间',
|
|
u_time timestamp not null default current_timestamp on update current_timestamp,
|
|
primary key(id),
|
|
key idx_user_subject (app_id,app_uid,status),
|
|
key idx_cate_subject (app_id,cate_id,status)
|
|
)ENGINE=InnoDB default CHARSET=utf8mb4 comment='动态表';
|
|
alter table lc_subjects add column hit_num int(10) not null default 0 comment '浏览量' after share_num;
|
|
alter table lc_subjects add column type tinyint(1) unsigned not null default 0 comment '类型 0图片 1视频' after app_uid;
|
|
alter table lc_subjects add column video varchar(128) not null default '' comment '视频地址' after imgs;
|
|
alter table lc_subjects add column sort int unsigned not null default 0 comment '排序,倒序' after top;
|
|
|
|
-- ----------------------------
|
|
-- Title:用户动态喜好表
|
|
-- Author:0fun
|
|
-- Table:lc_subject_user_fond
|
|
-- ---------------------------
|
|
drop table if exists lc_subject_user_fond;
|
|
create table lc_subject_user_fond(
|
|
id int unsigned not null auto_increment comment '自增id',
|
|
app_id int unsigned not null default 1 comment '小程序ID',
|
|
app_uid int unsigned not null comment '用户id',
|
|
type tinyint(1) not null default 0 comment '喜好类型 1收藏 2点赞 3分享',
|
|
sub_id int unsigned not null comment '动态id',
|
|
primary key (id)
|
|
)ENGINE=InnoDB default CHARSET=utf8mb4 comment='小程序用户喜好表';
|
|
alter table lc_subject_user_fond
|
|
add column ftype tinyint(1) unsigned not null default 0 comment '类型 0好评 1回复' after app_uid,
|
|
add column ftype_id int unsigned not null comment '目标ID' after ftype;
|
|
alter table lc_subject_user_fond add index idx_fond (app_id, app_uid) ;
|