db.sql 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. CREATE TABLE `account` (
  2. `account_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '账户编号',
  3. `phone` varchar(11) NOT NULL COMMENT '手机号码',
  4. `register_type` tinyint(4) NOT NULL COMMENT '注册房事, 见RegisterTypeEnum',
  5. `os` varchar(32) NOT NULL COMMENT '操作系统Android/iOS',
  6. `market` varchar(32) NOT NULL COMMENT '应用市场',
  7. `source` varchar(32) DEFAULT NULL COMMENT '注册来源',
  8. `state` tinyint(4) NOT NULL COMMENT '帐号状态, 见AccountStateEnum',
  9. `gmt_block_begin` DATETIME DEFAULT NULL COMMENT '帐号封禁开始时间',
  10. `gmt_block_end` DATETIME DEFAULT NULL COMMENT '帐号封禁截止时间',
  11. `gmt_create` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  12. `gmt_modified` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  13. PRIMARY KEY (`account_id`),
  14. UNIQUE KEY `uq_phone` (`phone`)
  15. ) ENGINE=InnoDB AUTO_INCREMENT=10000001 DEFAULT CHARSET=utf8mb4 COMMENT='帐号信息表';
  16. CREATE TABLE `account_third_wechat` (
  17. `openid` varchar(48) NOT NULL COMMENT '微信openid',
  18. `nickname` varchar(32) DEFAULT NULL COMMENT '微信昵称',
  19. `sex` tinyint(4) DEFAULT NULL COMMENT '性别 1-男 2-女 其他-未知',
  20. `headimgurl` varchar(512) DEFAULT NULL COMMENT '微信头像',
  21. `city` varchar(32) DEFAULT NULL COMMENT '城市',
  22. `province` varchar(32) DEFAULT NULL COMMENT '省份',
  23. `country` varchar(32) DEFAULT NULL COMMENT '国家',
  24. `unionid` varchar(48) DEFAULT NULL COMMENT '微信unionid',
  25. `account_id` bigint(20) unsigned NOT NULL COMMENT '账户编号',
  26. `gmt_create` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  27. `gmt_modified` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  28. PRIMARY KEY (`openid`)
  29. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='帐号微信授权表';
  30. CREATE TABLE `account_third_apple` (
  31. `sub` varchar(64) NOT NULL COMMENT '苹果身份标识',
  32. `user_id` varchar(64) DEFAULT NULL COMMENT '苹果用户id',
  33. `email` varchar(64) DEFAULT NULL COMMENT '邮箱',
  34. `account_id` bigint(20) unsigned NOT NULL COMMENT '账户编号',
  35. `gmt_create` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  36. `gmt_modified` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  37. PRIMARY KEY (`sub`)
  38. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='帐号苹果授权表';
  39. CREATE TABLE `account_login` (
  40. `login_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '登录编号',
  41. `account_id` bigint(20) unsigned NOT NULL COMMENT '账户编号',
  42. `date` varchar(10) NOT NULL COMMENT '登录日期yyyy-MM-dd',
  43. `os` varchar(32) NOT NULL COMMENT '操作系统Android/iOS',
  44. `market` varchar(32) NOT NULL COMMENT '应用市场',
  45. `isp` varchar(16) NOT NULL COMMENT '运营商',
  46. `client` varchar(32) NOT NULL COMMENT '客户端类型',
  47. `app_version` int(4) unsigned NOT NULL COMMENT 'APP版本号',
  48. `ip` int(4) NOT NULL DEFAULT 0 COMMENT '登录IP',
  49. `gmt_create` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  50. `gmt_modified` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  51. PRIMARY KEY (`login_id`)
  52. ) ENGINE=InnoDB AUTO_INCREMENT=1000000001 DEFAULT CHARSET=utf8mb4 COMMENT='帐号登录表';
  53. CREATE TABLE `account_device` (
  54. `device_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '设备编号',
  55. `device_no` varchar(64) NOT NULL COMMENT '客户端生成唯一码(UUID32位大写)',
  56. `idfa` varchar(64) DEFAULT NULL COMMENT '苹果IDFA(广告标识符)',
  57. `imei` varchar(64) DEFAULT NULL COMMENT '登录渠道',
  58. `oaid` varchar(64) DEFAULT NULL COMMENT '运营商',
  59. `androidid` varchar(64) DEFAULT NULL COMMENT '网络类型',
  60. `os` varchar(32) NOT NULL COMMENT '操作系统Android/iOS',
  61. `market` varchar(32) NOT NULL COMMENT '应用市场',
  62. `isp` varchar(16) NOT NULL COMMENT '运营商',
  63. `client` varchar(32) NOT NULL COMMENT '客户端类型',
  64. `app_version` int(4) unsigned NOT NULL COMMENT 'APP版本号',
  65. `ip` int(4) NOT NULL DEFAULT 0 COMMENT '登录IP',
  66. `account_id` bigint(20) DEFAULT NULL COMMENT '账户编号',
  67. `source` varchar(32) DEFAULT NULL COMMENT '注册来源',
  68. `gmt_create` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  69. `gmt_modified` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  70. PRIMARY KEY (`device_id`)
  71. ) ENGINE=InnoDB AUTO_INCREMENT=1000000001 DEFAULT CHARSET=utf8mb4 COMMENT='帐号设备表';