CREATE TABLE `p_user` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID',
  `nickname` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '昵称',
  `username` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户名',
  `phone` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '手机号',
  `password` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'MD5密码',
  `salt` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '盐值',
  `status` tinyint NOT NULL DEFAULT '0' COMMENT '用户状态0-正常1-封禁中2-禁言中3-删除',
  `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户头像',
	`sex` tinyint NOT NULL DEFAULT '0' COMMENT '性别 0 女、1 男',
	`like_count` int(10) NOT NULL DEFAULT '0' COMMENT '收获的点赞数量',
	`tweet_count` int(10) NOT NULL DEFAULT '0' COMMENT '帖子数量',
	`collection_count` int(10) NOT NULL DEFAULT '0' comment '收获的收藏数量',
	`follow_count` int(10) NOT NULL DEFAULT '0' comment '关注数量',
	`fans_count` int(10) NOT NULL DEFAULT '0' COMMENT '粉丝数量',
	`last_login_ip` varchar(32) NOT NULL DEFAULT '0' COMMENT '最后登录的ip',
	`created_on` bigint NOT NULL DEFAULT '0' COMMENT '创建时间',
  `modified_on` bigint NOT NULL DEFAULT '0' COMMENT '修改时间',
  `deleted_on` bigint NOT NULL DEFAULT '0' COMMENT '删除时间',
  `is_del` tinyint NOT NULL DEFAULT '0' COMMENT '是否删除 0 为未删除、1 为已删除',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `idx_user_username` (`username`) USING BTREE,
  KEY `idx_user_phone` (`phone`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=100060 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户';


CREATE TABLE `p_user_follow` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL DEFAULT '0' COMMENT '用户id',
	`to_user_id` bigint NOT NULL DEFAULT '0' COMMENT '被关注的用户id',
	`created_on` bigint NOT NULL DEFAULT '0' COMMENT '创建时间',
  `modified_on` bigint NOT NULL DEFAULT '0' COMMENT '修改时间',
  `deleted_on` bigint NOT NULL DEFAULT '0' COMMENT '删除时间',
  `is_del` tinyint NOT NULL DEFAULT '0' COMMENT '是否删除 0 为未删除、1 为已删除',
  PRIMARY KEY (`id`) USING BTREE,
	KEY `idx_user_follow` (`user_id`,`to_user_id`,`is_del`)
) ENGINE=InnoDB AUTO_INCREMENT=100060 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户关注表';