1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
| CREATE TABLE `user` ( `id` BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键id', `user_name` VARCHAR ( 20 ) NOT NULL DEFAULT '' COMMENT '用户名', `password` VARCHAR ( 100 ) NOT NULL DEFAULT '123456' COMMENT '密码', `email` VARCHAR ( 30 ) NOT NULL DEFAULT '' COMMENT '邮箱', `user_type` TINYINT ( 4 ) NOT NULL DEFAULT '0' COMMENT '用户类型(0:普通用户,1:媒体人,2:管理员)', `phone` VARCHAR ( 50 ) NOT NULL DEFAULT '' COMMENT '手机号', `show_phone` TINYINT ( 1 ) NOT NULL DEFAULT '0' COMMENT '是否展示手机号(0:是,1否)', `sign` VARCHAR ( 30 ) NOT NULL DEFAULT '' COMMENT '签名', `intro` VARCHAR ( 100 ) NOT NULL DEFAULT '' COMMENT '介绍', `valid` TINYINT ( 1 ) NOT NULL DEFAULT '1' COMMENT '是否有效(0:无效,1有效)', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY ( `id` ), UNIQUE KEY `idx_user_name` ( `user_name` ), UNIQUE KEY `idx_email` ( `email` ), KEY `idx_update_time` ( `update_time` ) ) ENGINE = INNODB AUTO_INCREMENT = 20 DEFAULT CHARSET = utf8mb4 COMMENT = '新闻用户表'; CREATE TABLE `user_cert` ( `id` BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键id', `user_id` BIGINT ( 20 ) NOT NULL DEFAULT '-1' COMMENT '用户id', `cert_info` VARCHAR ( 50 ) NOT NULL DEFAULT '' COMMENT '认证信息', `cert_material` VARCHAR ( 255 ) NOT NULL DEFAULT '' COMMENT '认证材料', `state` TINYINT ( 4 ) NOT NULL DEFAULT '0' COMMENT '认证状态(0:待审核,1:通过,2:未通过)', `remark` VARCHAR ( 50 ) NOT NULL DEFAULT '' COMMENT '备注', `valid` TINYINT ( 1 ) NOT NULL DEFAULT '1' COMMENT '是否有效(0:无效,1有效)', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY ( `id` ), KEY `idx_update_time` ( `update_time` ), KEY `idx_user_id` ( `user_id` ) ) ENGINE = INNODB AUTO_INCREMENT = 12 DEFAULT CHARSET = utf8mb4 COMMENT = '用户认证表'; CREATE TABLE `news` ( `id` BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键id', `category_id` BIGINT ( 20 ) NOT NULL DEFAULT '-1' COMMENT '新闻分类id', `user_id` BIGINT ( 20 ) NOT NULL DEFAULT '-1' COMMENT '作者id', `title` VARCHAR ( 50 ) NOT NULL DEFAULT '' COMMENT '新闻标题', `summary` VARCHAR ( 30 ) NOT NULL DEFAULT '' COMMENT '新闻摘要', `content` VARCHAR ( 1000 ) NOT NULL DEFAULT '' COMMENT '新闻内容', `state` TINYINT ( 4 ) NOT NULL DEFAULT '0' COMMENT '新闻状态(0:未操作,草稿状态,1:等待,2:通过,3:不通过)', `remark` VARCHAR ( 50 ) NOT NULL DEFAULT '' COMMENT '备注', `comment_count` INT ( 10 ) NOT NULL DEFAULT '0' COMMENT '评论数,只计算一级评论', `star_count` INT ( 10 ) NOT NULL DEFAULT '0' COMMENT '收藏数', `like_count` INT ( 10 ) NOT NULL DEFAULT '0' COMMENT '喜欢数', `valid` TINYINT ( 1 ) NOT NULL DEFAULT '1' COMMENT '是否有效(0:无效,1有效)', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY ( `id` ), KEY `idx_news_title` ( `title` ), KEY `idx_update_time` ( `update_time` ), KEY `idx_user_id` ( `user_id` ), KEY `idx_category_id` ( `category_id` ) ) ENGINE = INNODB AUTO_INCREMENT = 32 DEFAULT CHARSET = utf8mb4 COMMENT = '新闻表'; CREATE TABLE `news_category` ( `id` BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键id', `category_name` VARCHAR ( 10 ) NOT NULL DEFAULT '' COMMENT '新闻分类名', `valid` TINYINT ( 1 ) NOT NULL DEFAULT '1' COMMENT '是否有效(0:无效,1有效)', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY ( `id` ), KEY `idx_update_time` ( `update_time` ) ) ENGINE = INNODB AUTO_INCREMENT = 23 DEFAULT CHARSET = utf8mb4 COMMENT = '新闻分类表'; CREATE TABLE `news_comment` ( `id` BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键id', `news_id` BIGINT ( 20 ) NOT NULL DEFAULT '-1' COMMENT '新闻id', `user_id` BIGINT ( 20 ) NOT NULL DEFAULT '-1' COMMENT '作者id', `parent_id` BIGINT ( 20 ) NOT NULL DEFAULT '-1' COMMENT '父评论id', `is_top` TINYINT ( 1 ) NOT NULL DEFAULT '1' COMMENT '是否一级评论,只有两级评论', `content` VARCHAR ( 100 ) NOT NULL DEFAULT '' COMMENT '评论内容', `valid` TINYINT ( 1 ) NOT NULL DEFAULT '1' COMMENT '是否有效(0:无效,1有效)', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY ( `id` ), KEY `idx_update_time` ( `update_time` ), KEY `idx_news_id` ( `news_id` ) ) ENGINE = INNODB AUTO_INCREMENT = 20 DEFAULT CHARSET = utf8mb4 COMMENT = '新闻评论表'; CREATE TABLE `user_like_news` ( `id` BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键id', `news_id` BIGINT ( 20 ) NOT NULL DEFAULT '-1' COMMENT '新闻id', `user_id` BIGINT ( 20 ) NOT NULL DEFAULT '-1' COMMENT '用户id', `valid` TINYINT ( 1 ) NOT NULL DEFAULT '1' COMMENT '是否有效(0:无效,1有效)', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY ( `id` ), KEY `idx_update_time` ( `update_time` ), KEY `idx_user_id` ( `user_id` ), KEY `idx_news_id` ( `news_id` ) ) ENGINE = INNODB AUTO_INCREMENT = 25 DEFAULT CHARSET = utf8mb4 COMMENT = '用户喜欢新闻表'; CREATE TABLE `user_star_news` ( `id` BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键id', `news_id` BIGINT ( 20 ) NOT NULL DEFAULT '-1' COMMENT '新闻id', `user_id` BIGINT ( 20 ) NOT NULL DEFAULT '-1' COMMENT '用户id', `valid` TINYINT ( 1 ) NOT NULL DEFAULT '1' COMMENT '是否有效(0:无效,1有效)', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY ( `id` ), KEY `idx_update_time` ( `update_time` ), KEY `idx_user_id` ( `user_id` ), KEY `idx_news_id` ( `news_id` ) ) ENGINE = INNODB AUTO_INCREMENT = 14 DEFAULT CHARSET = utf8mb4 COMMENT = '用户收藏新闻表'; CREATE TABLE `feedback` ( `id` BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键id', `user_id` BIGINT ( 20 ) NOT NULL DEFAULT '-1' COMMENT '反馈人id', `type_id` BIGINT ( 20 ) NOT NULL DEFAULT '-1' COMMENT '反馈类型id', `content` VARCHAR ( 100 ) NOT NULL DEFAULT '' COMMENT '反馈内容', `state` TINYINT ( 1 ) NOT NULL DEFAULT '0' COMMENT '反馈状态(0:未处理,1:处理)', `remark` VARCHAR ( 50 ) NOT NULL DEFAULT '' COMMENT '备注', `valid` TINYINT ( 1 ) NOT NULL DEFAULT '1' COMMENT '是否有效(0:无效,1有效)', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY ( `id` ), KEY `idx_update_time` ( `update_time` ), KEY `idx_user_id` ( `user_id` ), KEY `idx_type_id` ( `type_id` ) ) ENGINE = INNODB AUTO_INCREMENT = 9 DEFAULT CHARSET = utf8mb4 COMMENT = '反馈表'; CREATE TABLE `feedback_type` ( `id` BIGINT ( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键id', `type_name` VARCHAR ( 20 ) NOT NULL DEFAULT '' COMMENT '反馈类型名', `valid` TINYINT ( 1 ) NOT NULL DEFAULT '1' COMMENT '是否有效(0:无效,1有效)', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY ( `id` ), KEY `idx_update_time` ( `update_time` ) ) ENGINE = INNODB AUTO_INCREMENT = 21 DEFAULT CHARSET = utf8mb4 COMMENT = '反馈类型表';
|