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