feat: 初始化 WWJ Cloud 企业级框架项目
- 后端:基于 NestJS 的分层架构设计 - 前端:基于 VbenAdmin + Element Plus 的管理系统 - 支持 SaaS + 独立版双架构模式 - 完整的用户权限管理系统 - 系统设置、文件上传、通知等核心功能 - 多租户支持和插件化扩展架构
This commit is contained in:
0
wwjcloud/src/migrations/.gitkeep
Normal file
0
wwjcloud/src/migrations/.gitkeep
Normal file
52
wwjcloud/src/migrations/1755845112842-InitSchema.ts
Normal file
52
wwjcloud/src/migrations/1755845112842-InitSchema.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class InitSchema1755845112842 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
// Admin 基线表(对应 common/auth/entities/admin.entity.ts)
|
||||
await queryRunner.query(`
|
||||
CREATE TABLE IF NOT EXISTS \`wwjauth_admins\` (
|
||||
\`id\` bigint unsigned NOT NULL AUTO_INCREMENT,
|
||||
\`username\` varchar(64) NOT NULL,
|
||||
\`mobile\` varchar(32) NULL DEFAULT NULL,
|
||||
\`password_hash\` varchar(255) NOT NULL,
|
||||
\`nickname\` varchar(128) NULL,
|
||||
\`avatar\` varchar(255) NULL,
|
||||
\`login_ip\` varchar(64) NULL,
|
||||
\`type\` tinyint NOT NULL DEFAULT 1,
|
||||
\`tenant_id\` int unsigned NOT NULL DEFAULT 0,
|
||||
\`last_login_at\` datetime NULL,
|
||||
\`created_at\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
\`updated_at\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
\`status\` enum('enabled','disabled') NOT NULL DEFAULT 'enabled',
|
||||
\`is_founder\` tinyint(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (\`id\`),
|
||||
UNIQUE KEY \`uk_admin_username\` (\`username\`),
|
||||
UNIQUE KEY \`uk_admin_mobile\` (\`mobile\`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
`);
|
||||
|
||||
// Member 基线表(对应 common/users/entities/member.entity.ts)
|
||||
await queryRunner.query(`
|
||||
CREATE TABLE IF NOT EXISTS \`member\` (
|
||||
\`member_id\` int unsigned NOT NULL AUTO_INCREMENT,
|
||||
\`username\` varchar(255) NOT NULL DEFAULT '',
|
||||
\`mobile\` varchar(20) NOT NULL DEFAULT '',
|
||||
\`password\` varchar(255) NOT NULL DEFAULT '',
|
||||
\`status\` tinyint NOT NULL DEFAULT 1,
|
||||
\`is_del\` tinyint NOT NULL DEFAULT 0,
|
||||
\`login_count\` int NOT NULL DEFAULT 0,
|
||||
\`login_time\` int NOT NULL DEFAULT 0,
|
||||
\`login_ip\` varchar(255) NOT NULL DEFAULT '',
|
||||
\`create_time\` int NOT NULL DEFAULT 0,
|
||||
\`update_time\` int NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (\`member_id\`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
// 回滚顺序与创建相反
|
||||
await queryRunner.query('DROP TABLE IF EXISTS `member`;');
|
||||
await queryRunner.query('DROP TABLE IF EXISTS `wwjauth_admins`;');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user