CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
jackfrued

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: jackfrued/Python-100-Days
Path: blob/master/Day36-45/code/app_store.sql
Views: 729
1
drop database if exists `app_store`;
2
3
create database `app_store` default character set utf8mb4;
4
5
use `app_store`;
6
7
create table `app_info` (
8
`id` bigint(20) not null auto_increment comment '自增id, app的id',
9
`app_name` varchar(255) default '' comment '名称',
10
`icon_url` varchar(255) default '' comment 'icon地址',
11
`version` varchar(32) default '' comment '版本号',
12
`app_size` varchar(32) default '' comment '包大小',
13
`banner_info` varchar(4096) default '' comment 'banner信息',
14
`developer_id` varchar(255) default '' comment '开发者id',
15
`summary` varchar(512) default '' comment '简介',
16
`app_desc` text comment '详细信息',
17
`download_url` varchar(255) default '' comment '下载链接',
18
`price` int(10) default '0' comment '价格,单位:分',
19
`status` tinyint(4) unsigned default '0' comment '状态,1:待审核,2:审核通过,3,已下线',
20
`version_desc` varchar(4096) default '' comment '',
21
`create_time` datetime not null default '0000-00-00 00:00:00' comment '创建时间',
22
`update_time` datetime not null default '0000-00-00 00:00:00' comment '更新时间',
23
primary key (`id`)
24
) engine=innodb auto_increment=100000 default charset=utf8mb4 comment='app基本信息表';
25
26
create table `app_ext_info` (
27
`id` bigint(20) not null auto_increment comment '自增id',
28
`app_id` bigint(20) not null default '0' comment 'app_id',
29
`install_count` bigint(20) unsigned not null default '0' comment 'app安装量',
30
`score` int(10) unsigned not null default '0' comment '评分',
31
`comment_count` int(10) unsigned not null default '0' comment '评论量',
32
`create_time` int(10) not null default 0 comment '创建时间',
33
`update_time` int(10) not null default 0 comment '更新时间',
34
primary key (`id`)
35
) engine=innodb default charset=utf8mb4 comment='App扩展信息表';
36
37
create table `app_category` (
38
`id` bigint(20) not null auto_increment comment '自增id',
39
`parent_id` bigint(20) not null default '0' comment '父分类id',
40
`name` varchar(64) not null default '' comment '分类名称',
41
`icon` varchar(512) not null default '' comment 'icon地址',
42
`category_desc` text comment '分类描述',
43
`category_level` tinyint(4) unsigned not null default '0' comment '分类级别',
44
`status` tinyint(4) unsigned not null default '0' comment '当前状态,1:使用中,隐藏',
45
`display_order` int(10) unsigned not null default '0' comment '排序,值越大越靠前',
46
`create_time` int(10) not null default 0 comment '创建时间',
47
`update_time` int(10) not null default 0 comment '更新时间',
48
primary key (`id`)
49
) engine=innodb default charset=utf8mb4 comment='分类信息表';
50
51
create table `app_category_rel` (
52
`id` bigint(20) not null auto_increment comment '自增id',
53
`app_id` bigint(20) not null default '0' comment 'app_id',
54
`category_id` bigint(20) unsigned not null default '0' comment '最低层分类id',
55
primary key (`id`),
56
unique key `idx_category_app` (`category_id`,`app_record_id`),
57
) engine=innodb default charset=utf8mb4 comment='App和分类关联表';
58
59
create table `app_comment` (
60
`id` bigint(20) not null auto_increment comment '自增id',
61
`app_id` bigint(20) not null default '0' comment 'app_id',
62
`title` varchar(255) default '' comment '评论标题',
63
`content` varchar(2048) default '' comment '评论内容',
64
`parent_id` bigint(20) default '0' comment '父评论id',
65
`commenter_uid` bigint(20) default '0' comment '评论用户id',
66
`commenter_name` varchar(255) default '' comment '评论用户名称',
67
`commenter_avatar` varchar(255) default '' comment '评论用户头像',
68
`top_flag` tinyint(4) default '0' comment '是否置顶',
69
`like_count` int(10) default '0' comment '评论的赞数量',
70
`status` tinyint(4) default '0' comment '评论状态',
71
`create_time` int(10) not null default 0 comment '创建时间',
72
`update_time` int(10) not null default 0 comment '更新时间',
73
primary key (`id`),
74
key `idx_app_status` (`app_id`, `status`, `top_flag`)
75
) engine=innodb default charset=utf8mb4 comment='评论信息表';
76
77
create table `user_app_relation` (
78
`id` bigint(20) not null auto_increment comment '自增id',
79
`user_id` bigint(20) unsigned not null default '0' comment '用户id',
80
`app_id` bigint(20) not null default '0' comment 'app_id',
81
`create_time` int(10) not null default 0 comment '创建时间',
82
`update_time` int(10) not null default 0 comment '更新时间',
83
`is_del` tinyint(4) not null default '0' comment '1:删除 0:未删除',
84
primary key (`id`),
85
key `idx_user_app` (`user_id`,`app_id`)
86
) engine=innodb auto_increment=8063 default charset=utf8mb4 comment='用户购买关系表';
87
88
create table `bot_score` (
89
`id` bigint(20) not null auto_increment comment '自增id',
90
`app_id` bigint(20) not null default '0' comment 'app_id',
91
`score` int(10) default '0' comment '用户评分',
92
`commenter_uid` bigint(20) default '0' comment '评分用户id',
93
`status` tinyint(4) default '0' comment '评分状态',
94
`create_time` int(10) not null default 0 comment '创建时间',
95
`update_time` int(10) not null default 0 comment '更新时间',
96
primary key (`id`),
97
unique key `idx_uid_score` (`app_id`,`commenter_uid`)
98
) engine=innodb default charset=utf8mb4 comment='App评分表';
99