应用商店建表

用MySQL建立一个应用商店的数据库(学习练手)
数据来源,网上公开资源

--APP信息表                                      
CREATE TABLE `app_info`(
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增ID, APP的Id',
`app_name` varchar(255) DEFAULT '' COMMENT '名称',
`licon_url` varchar(255) DEFAULT '' COMMENT 'icon地址', 
`version` varchar(32) DEFAULT '' COMMENT '版本号',
`app_size` varchar(32) DEFAULT '' COMMENT '包大小',
`banner_info` varchar (4096) DEFAULT '' COMMENT 'banner信息',
`developer_id` varchar(255) DEFAULT '' COMMENT '开发者Id',
`summary` varchar(512) DEFAULT '' COMMENT '简介',	
`app_desc` text COMMENT '详细信息',
`download_url` varchar(255) DEFAULT '' COMMENT '下载链接',
`price` int(10) DEFAULT '0' COMMENT '价格,单位:分',
`status` tinyint(4) unsigned DEFAULT '0' COMMENT '状态, 1:待审核, 2:审核通过, 3, 已下线',
`version_desc` varchar(4096) DEFAULT '' COMMENT '',
--`create_time` datetime DEFAULT '0000-00-00 00:00:00', 
--`update_time` datetime DEFAULT '0000-00-00 00:00:00',
`create_time` int(10) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(10) NOT NULL DEFAULT 0 COMMENT '更新',
PRIMARY KEY (`id`),
KEY `idx_app_name` (`app_name`),
KEY `idx_developer` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=100000 DEFAULT CHARSET=utf8 COMMENT= 'app信息表' ;

                                                      
--APP扩展信息表
CREATE TABLE `app_ext_info`(
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
`app_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'app_id',
`install_count` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'app安装量', 
`score` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '评分',
`comment_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '评论量', 
`create_time` int(10) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(10) NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `idx_app_id` (`app_id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='app扩展信息表';

--APP分类表                               
CREATE TABLE `app_category`(
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增ID', 
`parent_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '父分类id', 
`name` varchar(64) NOT NULL DEFAULT '' COMMENT '分类名称', 
`icon` varchar(512) NOT NULL DEFAULT '' COMMENT 'icon地址', 
`category_desc` text COMMENT '分类描述',
`category_level` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '分类级别', 
`status` tinyint (4) unsigned NOT NULL DEFAULT '0' COMMENT '当前状态, 1:使用中,隐藏',
`display_order` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '排序,值越大越靠前',
`create_time` int(10) NOT NULL DEFAULT 0 COMMENT '创建时间', 
`update_time` int(10) NOT NULL DEFAULT 0 COMMENT '更新', 
PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分类信息表';

--APP分类关系表                        
CREATE TABLE `app_category_rel`(
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增ID', 
`app_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'app_id',
`category_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '最低层分类ID', 
PRIMARY KEY (`id`),
UNIQUE KEY `idx_category_app` (`category_id`,`app_record_id`), 
KEY `idx_app` (`app_id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='app和分类关联表';

--APP评论表                      
CREATE TABLE `app_comment`(
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', 
`app_id` bigint (20) NOT NULL DEFAULT '0' COMMENT 'app_id', 
`title` varchar(255) DEFAULT '' COMMENT '评论标题',
`content` varchar(2048) DEFAULT '' COMMENT '评论内容',
`parent_id` bigint(20) DEFAULT '0' COMMENT '父评论Id', 
`commenter_uid` bigint(20) DEFAULT '0' COMMENT '评论用户Id',   
--`commenter_name` varchar(255) DEFAULT '' COMMENT '评论用户名称', 
--`commenter_avatar` varchar(255) DEFAULT '' COMMENT '品够你用户头像', 
`top_flag` tinyint(4) DEFAULT '0' COMMENT '是否置顶',
`like_count` int(10) DEFAULT '0' COMMENT '评论的赞数量',
`status` tinyint (4) DEFAULT '0' COMMENT '评论状态',
`create_time` int(10) NOT NULL DEFAULT 0 COMMENT '创建时间', 
`update_time` int(10) NOT NULL DEFAULT 0 COMMENT '更新l', 
PRIMARY KEY (`id`),
KEY `idx_app_status` (`app_id`,`status`,`top_flag`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='评论信息表';

--用户安装信息表                        
CREATE TABLE `user_app_relation`(
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`user_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '用户Id', 
`app_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'app_id',
`create_time` int(10) NOT NULL DEFAULT 0 COMMENT '创建时间', 
`update_time` int(10) NOT NULL DEFAULT 0 COMMENT '更新时间', 
`is_del` tinyint(4) NOT NULL DEFAULT '0' COMMENT '1:删除 0:未删除', 
PRIMARY KEY (`id`),
KEY `idx_user_app` (`user_id`,`app_id`)
)ENGINE=InnoDB AUTO_INCREMENT=8063 DEFAULT CHARSET=utf8 COMMENT='技能购买关系表';

--APP评分                       ``  ''   ()
CREATE TABLE `bot_score`(
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', 
`app_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'app_id', 
`score` int(10) DEFAULT '0' COMMENT '用户评分',
`commenter_uid` bigint(20) DEFAULT '0' COMMENT '评分用户Id', 
`status` tinyint(4) DEFAULT '0' COMMENT '评分状态',
`create_time` int(10) NOT NULL DEFAULT 0 COMMENT '创建时间', 
`update_time` int(10) NOT NULL DEFAULT 0 COMMENT '更新时间', 
PRIMARY KEY (`id`),
UNIQUE KEY `idx_uid_score` (`app_id`,`commenter_uid`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='APP评分表';
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值