/*
Navicat Premium Data Transfer
Source Server : localhost_3306
Source Server Type : MySQL
Source Server Version : 80100 (8.1.0)
Source Host : localhost:3306
Source Schema : ai_code
Target Server Type : MySQL
Target Server Version : 80100 (8.1.0)
File Encoding : 65001
Date: 20/01/2026 17:22:00
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for ai_model_config
-- ----------------------------
--
--
DROP TABLE IF EXISTS `ai_model_config`;
CREATE TABLE `ai_model_config` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
`modelKey` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '',
`modelName` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '',
`provider` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'openai/openrouter/iflow/dashscope',
`baseUrl` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'APIURL',
`tier` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`pointsPerKToken` int NOT NULL COMMENT '1K token',
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '',
`isEnabled` tinyint NULL DEFAULT 1 COMMENT '0-1-',
`sortOrder` int NULL DEFAULT 0 COMMENT '',
`qualityScore` decimal(3, 2) NULL DEFAULT 1.00 COMMENT '0.5-2.01.0',
`successRate` decimal(5, 2) NULL DEFAULT NULL COMMENT '0-100',
`avgTokenUsage` int NULL DEFAULT NULL COMMENT 'Token',
`userRating` decimal(3, 2) NULL DEFAULT NULL COMMENT '0-5',
`createTime` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updateTime` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`isDelete` tinyint NULL DEFAULT 0 COMMENT '0-1-',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `model_key`(`modelKey` ASC) USING BTREE,
INDEX `idx_tier`(`tier` ASC) USING BTREE,
INDEX `idx_provider`(`provider` ASC) USING BTREE,
INDEX `idx_is_enabled`(`isEnabled` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 24 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'AI' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for app
-- ----------------------------
DROP TABLE IF EXISTS `app`;
CREATE TABLE `app` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
`appName` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`cover` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`appType` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'app',
`initPrompt` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT ' prompt',
`codeGenType` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`deployKey` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`deployedTime` datetime NULL DEFAULT NULL COMMENT '',
`priority` int NOT NULL DEFAULT 0 COMMENT '',
`userId` bigint NOT NULL COMMENT 'id',
`spaceId` bigint NULL DEFAULT NULL COMMENT 'id',
`pageViews` bigint NULL DEFAULT 0 COMMENT '',
`editTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`createTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`isDelete` tinyint NOT NULL DEFAULT 0 COMMENT '',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_deployKey`(`deployKey` ASC) USING BTREE,
INDEX `idx_appName`(`appName` ASC) USING BTREE,
INDEX `idx_userId`(`userId` ASC) USING BTREE,
INDEX `idx_spaceId`(`spaceId` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2012841617930133507 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for chat_history
-- ----------------------------
DROP TABLE IF EXISTS `chat_history`;
CREATE TABLE `chat_history` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
`messageContent` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '',
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`messageType` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'user/ai',
`appId` bigint NOT NULL COMMENT 'id',
`userId` bigint NOT NULL COMMENT 'id',
`createTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`isDelete` tinyint NOT NULL DEFAULT 0 COMMENT '',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_appId`(`appId` ASC) USING BTREE,
INDEX `idx_createTime`(`createTime` ASC) USING BTREE,
INDEX `idx_appId_createTime`(`appId` ASC, `createTime` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2012849320459051010 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for code_snippet
-- ----------------------------
DROP TABLE IF EXISTS `code_snippet`;
CREATE TABLE `code_snippet` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
`snippetName` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '',
`snippetType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '',
`snippetCategory` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '',
`snippetDesc` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '',
`snippetCode` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '',
`usageScenario` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '',
`tags` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '',
`isActive` tinyint NULL DEFAULT 1 COMMENT '0-1-',
`priority` int NULL DEFAULT 0 COMMENT '',
`creatorId` bigint NULL DEFAULT NULL COMMENT 'ID',
`createTime` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updateTime` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`isDelete` tinyint NULL DEFAULT 0 COMMENT '0-1-',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_type_category`(`snippetType` ASC, `snippetCategory` ASC) USING BTREE,
INDEX `idx_tags`(`tags`(100) ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 34 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for comment
-- ----------------------------
DROP TABLE IF EXISTS `comment`;
CREATE TABLE `comment` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
`appId` bigint NOT NULL COMMENT 'ID',
`commentType` int NOT NULL DEFAULT 1 COMMENT '1-, 2-',
`parentId` bigint NULL DEFAULT NULL COMMENT 'IDnull',
`userId` bigint NOT NULL COMMENT 'ID',
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '',
`likeCount` int NOT NULL DEFAULT 0 COMMENT '',
`replyCount` int NOT NULL DEFAULT 0 COMMENT '',
`createTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`isDelete` tinyint NOT NULL DEFAULT 0 COMMENT '',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_appId`(`appId` ASC) USING BTREE,
INDEX `idx_parentId`(`parentId` ASC) USING BTREE,
INDEX `idx_userId`(`userId` ASC) USING BTREE,
INDEX `idx_createTime`(`createTime` ASC) USING BTREE,
INDEX `idx_likeCount`(`likeCount` ASC) USING BTREE,
INDEX `idx_replyCount`(`replyCount` ASC) USING BTREE,
INDEX `idx_appId_parentId`(`appId` ASC, `parentId` ASC) USING BTREE,
INDEX `idx_commentType`(`commentType` ASC) USING BTREE,
INDEX `idx_commentType_appId_parentId`(`commentType` ASC, `appId` ASC, `parentId` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 369746142501130241 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for email_verification_code
-- ----------------------------
DROP TABLE IF EXISTS `email_verification_code`;
CREATE TABLE `email_verification_code` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
`email` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '',
`code` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '',
`type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT ':REGISTER-, RESET_PASSWORD-, LOGIN-',
`expireTime` datetime NOT NULL COMMENT '',
`verified` tinyint NULL DEFAULT 0 COMMENT ':0-, 1-',
`createTime` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updateTime` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`isDelete` tinyint NULL DEFAULT 0 COMMENT ':0-,1-',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_email`(`email` ASC) USING BTREE,
INDEX `idx_email_type`(`email` ASC, `type` ASC) USING BTREE,
INDEX `idx_expire`(`expireTime` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for forum_post
-- ----------------------------
DROP TABLE IF EXISTS `forum_post`;
CREATE TABLE `forum_post` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
`title` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '',
`content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '',
`appId` bigint NULL DEFAULT NULL COMMENT 'ID',
`userId` bigint NOT NULL COMMENT 'ID',
`viewCount` int NOT NULL DEFAULT 0 COMMENT '',
`likeCount` int NOT NULL DEFAULT 0 COMMENT '',
`commentCount` int NOT NULL DEFAULT 0 COMMENT '',
`isPinned` tinyint NOT NULL DEFAULT 0 COMMENT '',
`createTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`isDelete` tinyint NOT NULL DEFAULT 0 COMMENT '',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_appId`(`appId` ASC) USING BTREE,
INDEX `idx_userId`(`userId` ASC) USING BTREE,
INDEX `idx_createTime`(`createTime` ASC) USING BTREE,
INDEX `idx_likeCount`(`likeCount` ASC) USING BTREE,
INDEX `idx_viewCount`(`viewCount` ASC) USING BTREE,
INDEX `idx_isPinned`(`isPinned` ASC) USING BTREE,
INDEX `idx_createTime_isPinned`(`createTime` ASC, `isPinned` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 368694475747868673 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for friend_relation
-- ----------------------------
DROP TABLE IF EXISTS `friend_relation`;
CREATE TABLE `friend_relation` (
`id` bigint NOT NULL AUTO_INCREMENT,
`userId` bigint NOT NULL,
`friendId` bigint NOT NULL,
`status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
`createTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`isDelete` tinyint NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_user_friend`(`userId` ASC, `friendId` ASC) USING BTREE,
INDEX `idx_user`(`userId` ASC, `status` ASC) USING BTREE,
INDEX `idx_friend`(`friendId` ASC, `status` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 369629079119917057 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for friend_request
-- ----------------------------
DROP TABLE IF EXISTS `friend_request`;
CREATE TABLE `friend_request` (
`id` bigint NOT NULL AUTO_INCREMENT,
`requesterId` bigint NOT NULL,
`addresseeId` bigint NOT NULL,
`status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING',
`message` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`createTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`isDelete` tinyint NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_requester_addressee`(`requesterId` ASC, `addresseeId` ASC, `status` ASC) USING BTREE,
INDEX `idx_requester`(`requesterId` ASC, `status` ASC) USING BTREE,
INDEX `idx_addressee`(`addresseeId` ASC, `status` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 369628190732775425 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for invite_record
-- ----------------------------
DROP TABLE IF EXISTS `invite_record`;
CREATE TABLE `invite_record` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
`inviterId` bigint NOT NULL COMMENT 'ID',
`inviteeId` bigint NOT NULL COMMENT 'ID',
`inviteCode` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '',
`registerIp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'IP',
`deviceId` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'ID',
`status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT 'PENDING' COMMENT 'PENDING:, REGISTERED:, REWARDED:',
`inviterPoints` int NULL DEFAULT 0 COMMENT '',
`inviteePoints` int NULL DEFAULT 0 COMMENT '',
`createTime` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`registerTime` datetime NULL DEFAULT NULL COMMENT '',
`rewardTime` datetime NULL DEFAULT NULL COMMENT '',
`isDelete` tinyint NULL DEFAULT 0 COMMENT '',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_inviteCode`(`inviteCode` ASC) USING BTREE,
INDEX `idx_inviterId`(`inviterId` ASC) USING BTREE,
INDEX `idx_inviteeId`(`inviteeId` ASC) USING BTREE,
INDEX `idx_status`(`status` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for points_record
-- ----------------------------
DROP TABLE IF EXISTS `points_record`;
CREATE TABLE `points_record` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
`userId` bigint NOT NULL COMMENT 'ID',
`points` int NOT NULL COMMENT '',
`balance` int NOT NULL COMMENT '',
`type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'SIGN_IN:, REGISTER:, INVITE:, GENERATE:, EXPIRE:',
`reason` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '',
`status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT 'completed' COMMENT 'pending-completed-failed-expired-',
`remainingPoints` int NULL DEFAULT NULL COMMENT '',
`modelKey` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'key',
`tokenCount` int NULL DEFAULT NULL COMMENT 'token',
`relatedId` bigint NULL DEFAULT NULL COMMENT 'IDIDID',
`expireTime` datetime NULL DEFAULT NULL COMMENT '',
`createTime` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`isDelete` tinyint NULL DEFAULT 0 COMMENT '',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_userId`(`userId` ASC) USING BTREE,
INDEX `idx_type`(`type` ASC) USING BTREE,
INDEX `idx_createTime`(`createTime` ASC) USING BTREE,
INDEX `idx_expireTime`(`expireTime` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for sign_in_record
-- ----------------------------
DROP TABLE IF EXISTS `sign_in_record`;
CREATE TABLE `sign_in_record` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
`userId` bigint NOT NULL COMMENT 'ID',
`signInDate` date NOT NULL COMMENT '',
`continuousDays` int NULL DEFAULT 1 COMMENT '',
`pointsEarned` int NOT NULL COMMENT '',
`createTime` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`isDelete` tinyint NULL DEFAULT 0 COMMENT '',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_userId_date`(`userId` ASC, `signInDate` ASC) USING BTREE,
INDEX `idx_userId`(`userId` ASC) USING BTREE,
INDEX `idx_signInDate`(`signInDate` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for space
-- ----------------------------
DROP TABLE IF EXISTS `space`;
CREATE TABLE `space` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
`spaceName` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '',
`spaceType` tinyint NOT NULL DEFAULT 1 COMMENT '1-2-',
`ownerId` bigint NOT NULL COMMENT 'id',
`description` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '',
`memberCount` int NULL DEFAULT 0 COMMENT '',
`appCount` int NULL DEFAULT 0 COMMENT '',
`createTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`isDelete` tinyint NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_ownerId`(`ownerId` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 369314979156369409 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for space_user
-- ----------------------------
DROP TABLE IF EXISTS `space_user`;
CREATE TABLE `space_user` (
`id` bigint NOT NULL AUTO_INCREMENT,
`spaceId` bigint NOT NULL COMMENT 'id',
`userId` bigint NOT NULL COMMENT 'id',
`role` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'MEMBER' COMMENT 'OWNER-ADMIN-MEMBER-',
`permissions` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '',
`joinTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`createTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_space_user`(`spaceId` ASC, `userId` ASC) USING BTREE,
INDEX `idx_userId`(`userId` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 369632735886110721 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
`userAccount` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '',
`userPassword` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '',
`userName` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`userAvatar` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`userProfile` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`userEmail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '',
`emailVerified` tinyint NULL DEFAULT 0 COMMENT '0-1-',
`userRole` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'user' COMMENT 'user/admin',
`editTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`createTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`isDelete` tinyint NOT NULL DEFAULT 0 COMMENT '',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_userAccount`(`userAccount` ASC) USING BTREE,
INDEX `idx_userName`(`userName` ASC) USING BTREE,
INDEX `idx_userEmail`(`userEmail` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2012758242770890754 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for user_points
-- ----------------------------
DROP TABLE IF EXISTS `user_points`;
CREATE TABLE `user_points` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
`userId` bigint NOT NULL COMMENT 'ID',
`totalPoints` int NULL DEFAULT 0 COMMENT '',
`availablePoints` int NULL DEFAULT 0 COMMENT '',
`frozenPoints` int NULL DEFAULT 0 COMMENT '',
`createTime` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`updateTime` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
`isDelete` tinyint NULL DEFAULT 0 COMMENT '0-1-',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_userId`(`userId` ASC) USING BTREE,
INDEX `idx_availablePoints`(`availablePoints` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '' ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;