/*
 Navicat Premium Data Transfer

 Source Server         : mysql57-209
 Source Server Type    : MySQL
 Source Server Version : 50736
 Source Host           : 192.168.0.209:3306
 Source Schema         : tnb_account_tdb

 Target Server Type    : MySQL
 Target Server Version : 50736
 File Encoding         : 65001

 Date: 13/01/2026 20:39:19
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for account_user_account
-- ----------------------------
DROP TABLE IF EXISTS `account_user_account`;
CREATE TABLE `account_user_account` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `deleted` bit(1) NOT NULL DEFAULT b'0',
  `create_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `update_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `user_id` bigint(20) NOT NULL COMMENT '用户 ID, 全局唯一',
  `username` varchar(255) NOT NULL COMMENT '用户名, 全局唯一',
  `mobile` varchar(13) DEFAULT NULL COMMENT '手机号, 全局唯一',
  `encoded_password` varchar(255) NOT NULL,
  `salt` varchar(255) NOT NULL,
  `create_at` datetime(6) NOT NULL COMMENT '帐号创建时间',
  `enabled` bit(1) NOT NULL COMMENT 'spring-security 字段',
  `locked` bit(1) NOT NULL COMMENT 'spring-security 字段',
  `screen_name` varchar(255) NOT NULL,
  `avatar_url` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL COMMENT '邮箱, 全局唯一',
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_id` (`user_id`) USING BTREE,
  UNIQUE KEY `username` (`username`) USING BTREE,
  UNIQUE KEY `index_screen_name` (`screen_name`),
  UNIQUE KEY `email` (`email`) USING BTREE,
  UNIQUE KEY `mobile` (`mobile`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2057872 DEFAULT CHARSET=utf8mb4 COMMENT='用户帐号';

-- ----------------------------
-- Table structure for account_user_login
-- ----------------------------
DROP TABLE IF EXISTS `account_user_login`;
CREATE TABLE `account_user_login` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `deleted` bit(1) NOT NULL DEFAULT b'0',
  `create_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `update_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `login_id` varchar(255) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `login_type` int(11) NOT NULL,
  `user_agent` text NOT NULL,
  `login_ip` varchar(255) NOT NULL,
  `login_at` bigint(20) NOT NULL COMMENT 'ms 时间戳',
  `plat` int(11) NOT NULL,
  `remember_me` tinyint(1) NOT NULL,
  `success` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `login_id` (`login_id`),
  KEY `user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=241 DEFAULT CHARSET=utf8mb4 COMMENT='用户登录记录';

-- ----------------------------
-- Table structure for account_user_registry
-- ----------------------------
DROP TABLE IF EXISTS `account_user_registry`;
CREATE TABLE `account_user_registry` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `deleted` bit(1) NOT NULL DEFAULT b'0',
  `create_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `update_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `enabled` bit(1) NOT NULL COMMENT '是否开放注册',
  `captcha_code` varchar(255) NOT NULL,
  `enable_captcha` bit(1) NOT NULL,
  `verify_code` varchar(255) NOT NULL,
  `enable_verify` bit(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='帐号开放注册规则';

-- ----------------------------
-- Table structure for account_user_role
-- ----------------------------
DROP TABLE IF EXISTS `account_user_role`;
CREATE TABLE `account_user_role` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `user_id_2` (`user_id`,`name`),
  KEY `name` (`name`) USING BTREE,
  KEY `user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COMMENT='用户帐号拥有的角色';

-- ----------------------------
-- Table structure for message_email_account
-- ----------------------------
DROP TABLE IF EXISTS `message_email_account`;
CREATE TABLE `message_email_account` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `deleted` bit(1) NOT NULL DEFAULT b'0',
  `create_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `update_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `smtp` varchar(255) NOT NULL,
  `username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `personal` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for message_user_message
-- ----------------------------
DROP TABLE IF EXISTS `message_user_message`;
CREATE TABLE `message_user_message` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `deleted` bit(1) NOT NULL DEFAULT b'0',
  `create_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `update_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `msg_type` int(11) NOT NULL,
  `message_id` bigint(20) NOT NULL,
  `title` varchar(255) NOT NULL,
  `content` varchar(255) NOT NULL,
  `unread` bit(1) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=786 DEFAULT CHARSET=utf8mb4 COMMENT='用户消息';

-- ----------------------------
-- Table structure for message_webhook
-- ----------------------------
DROP TABLE IF EXISTS `message_webhook`;
CREATE TABLE `message_webhook` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `deleted` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `name` varchar(255) NOT NULL,
  `url` varchar(255) NOT NULL,
  `sign` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_gpaf6ryyim70bbv5jfnopn2i7` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='webhook 通知';

-- ----------------------------
-- Table structure for user_contact
-- ----------------------------
DROP TABLE IF EXISTS `user_contact`;
CREATE TABLE `user_contact` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `deleted` bit(1) NOT NULL DEFAULT b'0',
  `create_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `update_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `friend_id` bigint(20) NOT NULL,
  `remark_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '备注名',
  `status` int(10) NOT NULL COMMENT '关系状态',
  `owner` bigint(20) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `user_id` (`owner`) USING BTREE,
  KEY `friend_id` (`friend_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='联系人';

-- ----------------------------
-- Table structure for user_contact_record
-- ----------------------------
DROP TABLE IF EXISTS `user_contact_record`;
CREATE TABLE `user_contact_record` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `deleted` bit(1) NOT NULL DEFAULT b'0',
  `create_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `update_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `apply_id` bigint(20) NOT NULL,
  `apply_user` bigint(20) NOT NULL,
  `applied_user` bigint(20) NOT NULL,
  `friend_status` int(10) NOT NULL,
  `apply_status` int(10) NOT NULL,
  `remark` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  KEY `user_id` (`apply_user`) USING BTREE,
  KEY `friend_id` (`applied_user`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='联系人申请记录';

-- ----------------------------
-- Table structure for user_profile
-- ----------------------------
DROP TABLE IF EXISTS `user_profile`;
CREATE TABLE `user_profile` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `deleted` bit(1) NOT NULL DEFAULT b'0',
  `create_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `update_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `user_id` bigint(20) NOT NULL,
  `gender` varchar(255) NOT NULL,
  `signature` varchar(255) NOT NULL COMMENT '用户自我介绍',
  `following` int(11) NOT NULL,
  `follower` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=420962 DEFAULT CHARSET=utf8mb4 COMMENT='用户信息';

-- ----------------------------
-- Table structure for user_relation
-- ----------------------------
DROP TABLE IF EXISTS `user_relation`;
CREATE TABLE `user_relation` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `deleted` bit(1) NOT NULL,
  `create_time` datetime(6) NOT NULL ON UPDATE CURRENT_TIMESTAMP(6),
  `update_time` datetime(6) NOT NULL ON UPDATE CURRENT_TIMESTAMP(6),
  `user_id` bigint(20) NOT NULL,
  `following_id` bigint(20) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_id` (`user_id`,`following_id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COMMENT='用户关系';

-- ----------------------------
-- Table structure for user_vip
-- ----------------------------
DROP TABLE IF EXISTS `user_vip`;
CREATE TABLE `user_vip` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `deleted` bit(1) NOT NULL DEFAULT b'0',
  `create_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `update_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `user_id` bigint(20) NOT NULL COMMENT '用户 ID',
  `expire_at` bigint(20) NOT NULL COMMENT 'VIP 用户过期时间',
  `rcmd_mode` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COMMENT='小会员用户';

-- ----------------------------
-- Table structure for user_wallet_bill
-- ----------------------------
DROP TABLE IF EXISTS `user_wallet_bill`;
CREATE TABLE `user_wallet_bill` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `deleted` bit(1) NOT NULL DEFAULT b'0',
  `create_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `update_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `type` int(11) NOT NULL COMMENT '1 - 收入, 2 - 支出',
  `quantity` double NOT NULL,
  `create_at` datetime(6) NOT NULL,
  `owner` bigint(20) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COMMENT='用户钱包账单';

-- ----------------------------
-- Table structure for user_wallet_charge
-- ----------------------------
DROP TABLE IF EXISTS `user_wallet_charge`;
CREATE TABLE `user_wallet_charge` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `deleted` bit(1) NOT NULL DEFAULT b'0',
  `create_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `update_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `charge_id` bigint(20) NOT NULL,
  `quantity` double NOT NULL,
  `owner` bigint(20) NOT NULL,
  `status` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `owner` (`charge_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COMMENT='用户钱包充值';

SET FOREIGN_KEY_CHECKS = 1;
