创建表脚本 1.9 KB

1234567891011121314151617181920212223242526272829303132333435
  1. -- 客户端签名
  2. CREATE TABLE `director`.`t_app_sign` (
  3. `id` bigint(10) NOT NULL AUTO_INCREMENT,
  4. `client_name` varchar(8) NULL COMMENT '客户端名称',
  5. `app_version` varchar(10) NULL COMMENT 'app版本号',
  6. `sign_key` varchar(64) NULL COMMENT '签名的key',
  7. PRIMARY KEY (`id`)
  8. ) COMMENT = '客户端加密密钥表';
  9. -- 用户表
  10. ALTER TABLE `director`.`t_user`
  11. CHANGE COLUMN `user_name` `nick_name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '昵称' AFTER `id`,
  12. CHANGE COLUMN `password` `head_img` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '头像' AFTER `nick_name`,
  13. MODIFY COLUMN `id` bigint(10) NOT NULL AUTO_INCREMENT COMMENT '用户id' FIRST,
  14. ADD COLUMN `wx_id` varchar(32) NULL COMMENT '微信id' AFTER `id`,
  15. ADD COLUMN `apple_id` varchar(64) NULL COMMENT '苹果id身份信息' AFTER `wx_id`,
  16. ADD COLUMN `phone` varchar(16) NULL COMMENT '手机号码' AFTER `head_img`,
  17. ADD COLUMN `create_time` timestamp(0) NULL COMMENT '创建时间' AFTER `phone`,
  18. ADD COLUMN `update_time` timestamp(0) NULL COMMENT '更新时间' AFTER `create_time`,
  19. ADD COLUMN `device_token` varchar(64) NULL COMMENT '设备号' AFTER `update_time`,
  20. ADD COLUMN `logic_delete` tinyint(2) NOT NULL DEFAULT 0 COMMENT '逻辑删除' AFTER `device_token`,
  21. ADD UNIQUE INDEX `idx_phone`(`phone`(16)) USING BTREE COMMENT '手机号码做唯一索引',
  22. ADD UNIQUE INDEX `idx_wx_id`(`wx_id`(32)) USING BTREE COMMENT '微信id做唯一索引',
  23. ADD UNIQUE INDEX `idx_apple_id`(`apple_id`(64)) USING BTREE COMMENT '苹果id做唯一索引',
  24. COMMENT = '用户表';
  25. -- 用户信息表
  26. CREATE TABLE `director`.`t_user_info` (
  27. `id` bigint(10) NOT NULL COMMENT 'id',
  28. `user_id` bigint(10) NULL COMMENT '用户id',
  29. `gender` tinyint(2) NULL COMMENT '性别',
  30. PRIMARY KEY (`id`),
  31. UNIQUE INDEX `idx_userId`(`user_id`) USING BTREE COMMENT '用户id唯一索引'
  32. );