新零售-用户相关数据表设计

-- 用户表
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user`  (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '用户ID',
  `user_name` varchar(128) NOT NULL COMMENT '用户名',
  `password` varchar(60) NOT NULL COMMENT '加密后的密码',
  `salt` char(10) NOT NULL COMMENT '用户加密盐',
  `wechat` varchar(30) NOT NULL DEFAULT '' COMMENT '绑定的微信号',
  `qq` varchar(20) NOT NULL DEFAULT '' COMMENT '绑定的QQ号',
  `tel` char(11) NOT NULL DEFAULT '' COMMENT '绑定的手机号',
  `user_status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '用户状态 1-正常 2-被冻结 3-已注销',
  `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后修改时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `unq_username`(`user_name`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COMMENT = '用户表';

-- 用户收获地址表
DROP TABLE IF EXISTS `user_address`;
CREATE TABLE `user_address`  (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '收获地址ID',
  `user_id` int(10) UNSIGNED NOT NULL COMMENT '用户ID,关联user表',
  `name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '收货人姓名',
  `tel` char(11) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '收货人电话',
  `address` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '收货人地址',
  `is_default` tinyint(1) NOT NULL COMMENT '是否默认地址 0-不是 1-是',
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已被删除 0-未被删除 1-已被删除',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_user_id`(`user_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COMMENT = '用户收获地址表';