feat: add TypeORM CLI migration support #26
21
apps/server/datasource.ts
Normal file
21
apps/server/datasource.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
import { config } from 'dotenv';
|
||||
import { join } from 'path';
|
||||
|
||||
// TypeORM CLI runs from apps/server/
|
||||
const root = process.cwd();
|
||||
config({ path: join(root, '.env') });
|
||||
|
||||
const dbType = process.env.DB_TYPE || 'sqlite';
|
||||
|
||||
export default new DataSource({
|
||||
type: dbType === 'mysql' ? 'mysql' : 'better-sqlite3',
|
||||
host: dbType === 'mysql' ? (process.env.DB_HOST || 'localhost') : undefined,
|
||||
port: dbType === 'mysql' ? (Number(process.env.DB_PORT) || 3306) : undefined,
|
||||
username: dbType === 'mysql' ? (process.env.DB_USERNAME || 'root') : undefined,
|
||||
password: dbType === 'mysql' ? (process.env.DB_PASSWORD || '') : undefined,
|
||||
database: process.env.DB_DATABASE || (dbType === 'mysql' ? 'dorm_billing' : 'dorm_billing.db'),
|
||||
charset: dbType === 'mysql' ? 'utf8mb4' : undefined,
|
||||
entities: [join(root, 'src/**/*.entity.ts')],
|
||||
migrations: [join(root, 'src/migrations/*.ts')],
|
||||
});
|
||||
@@ -19,7 +19,12 @@
|
||||
"test:watch": "jest --watch",
|
||||
"test:cov": "jest --coverage",
|
||||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
||||
"test:e2e": "jest --config ./test/jest-e2e.json"
|
||||
"test:e2e": "jest --config ./test/jest-e2e.json",
|
||||
"migration:generate": "ts-node -r tsconfig-paths/register -P tsconfig.json ../../node_modules/typeorm/cli.js -d datasource.ts migration:generate",
|
||||
"migration:create": "ts-node -r tsconfig-paths/register -P tsconfig.json ../../node_modules/typeorm/cli.js -d datasource.ts migration:create",
|
||||
"migration:run": "ts-node -r tsconfig-paths/register -P tsconfig.json ../../node_modules/typeorm/cli.js -d datasource.ts migration:run",
|
||||
"migration:revert": "ts-node -r tsconfig-paths/register -P tsconfig.json ../../node_modules/typeorm/cli.js -d datasource.ts migration:revert",
|
||||
"migration:show": "ts-node -r tsconfig-paths/register -P tsconfig.json ../../node_modules/typeorm/cli.js -d datasource.ts migration:show"
|
||||
},
|
||||
"dependencies": {
|
||||
"@casl/ability": "^7.0.1",
|
||||
|
||||
244
apps/server/src/migrations/1784520727860-InitialSchema.ts
Normal file
244
apps/server/src/migrations/1784520727860-InitialSchema.ts
Normal file
@@ -0,0 +1,244 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class InitialSchema1784520727860 implements MigrationInterface {
|
||||
name = 'InitialSchema1784520727860'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`CREATE TABLE \`wallet_transactions\` (\`id\` int NOT NULL AUTO_INCREMENT, \`student_id\` int NOT NULL, \`bill_id\` int NULL, \`operation_id\` varchar(64) NULL, \`type\` varchar(30) NOT NULL, \`amount\` decimal(12,2) NOT NULL, \`balance_after\` decimal(12,2) NOT NULL, \`description\` varchar(300) NULL, \`recorded_by\` int NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), INDEX \`IDX_680bbd0275ac5e06c179f9b84c\` (\`student_id\`, \`created_at\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`permissions\` (\`id\` int NOT NULL AUTO_INCREMENT, \`code\` varchar(50) NOT NULL, \`name\` varchar(50) NOT NULL, \`group\` varchar(30) NOT NULL, \`description\` varchar(200) NULL, UNIQUE INDEX \`IDX_8dad765629e83229da6feda1c1\` (\`code\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`roles\` (\`id\` int NOT NULL AUTO_INCREMENT, \`name\` varchar(30) NOT NULL, \`code\` varchar(30) NULL, \`description\` varchar(200) NULL, \`is_system\` tinyint NOT NULL DEFAULT 0, \`status\` tinyint NOT NULL DEFAULT '1', \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_648e3f5447f725579d7d4ffdfb\` (\`name\`), UNIQUE INDEX \`IDX_f6d54f95c31b73fb1bdd8e91d0\` (\`code\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`users\` (\`id\` int NOT NULL AUTO_INCREMENT, \`username\` varchar(50) NOT NULL, \`password_hash\` varchar(255) NOT NULL, \`name\` varchar(50) NULL, \`is_active\` tinyint NOT NULL DEFAULT 1, \`last_login_at\` datetime NULL, \`is_archived\` tinyint NOT NULL DEFAULT 0, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`profile\` text NULL, UNIQUE INDEX \`IDX_fe0bb3f6520ee0469504521e71\` (\`username\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`sync_state\` (\`platform\` varchar(20) NOT NULL, \`last_sync_at\` datetime NULL, \`run_id\` varchar(64) NULL, \`running_since\` datetime NULL, PRIMARY KEY (\`platform\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`sync_logs\` (\`id\` int NOT NULL AUTO_INCREMENT, \`platform\` varchar(20) NOT NULL, \`sync_type\` varchar(20) NOT NULL, \`status\` varchar(20) NOT NULL, \`records_count\` int NOT NULL DEFAULT '0', \`error_message\` text NULL, \`started_at\` datetime NULL, \`finished_at\` datetime NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`room_expenses\` (\`id\` int NOT NULL AUTO_INCREMENT, \`room_id\` int NOT NULL, \`expense_type\` varchar(20) NOT NULL, \`amount\` decimal(10,2) NOT NULL, \`period_start\` date NOT NULL, \`period_end\` date NOT NULL, \`description\` text NULL, \`recorded_by\` int NULL, \`import_key\` varchar(120) NULL, \`status\` varchar(20) NOT NULL DEFAULT 'active', \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_050485162d4fe47bd3cfd7dedb\` (\`import_key\`), UNIQUE INDEX \`IDX_050485162d4fe47bd3cfd7dedb\` (\`import_key\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`rooms\` (\`id\` int NOT NULL AUTO_INCREMENT, \`room_number\` varchar(20) NOT NULL, \`building\` varchar(50) NULL, \`floor\` int NULL, \`capacity\` int NOT NULL, \`status\` varchar(20) NOT NULL DEFAULT 'available', \`room_type\` varchar(20) NULL, \`rental_category\` varchar(10) NOT NULL DEFAULT 'short', \`monthly_rate\` decimal(10,2) NOT NULL DEFAULT '0.00', \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_8f7c6fa4c469bab1a06fe3e49f\` (\`room_number\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`organizations\` (\`id\` int NOT NULL AUTO_INCREMENT, \`public_id\` varchar(36) NOT NULL, \`code\` varchar(50) NOT NULL, \`name\` varchar(100) NOT NULL, \`is_host\` tinyint NOT NULL DEFAULT 0, \`contact_name\` varchar(50) NULL, \`phone\` varchar(30) NULL, \`color\` varchar(20) NULL, \`notes\` text NULL, \`status\` varchar(20) NOT NULL DEFAULT 'active', \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_0db5eda192bf60a02bd41931f8\` (\`public_id\`), UNIQUE INDEX \`IDX_7e27c3b62c681fbe3e2322535f\` (\`code\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`beds\` (\`id\` int NOT NULL AUTO_INCREMENT, \`room_id\` int NOT NULL, \`bed_number\` varchar(20) NOT NULL, \`status\` varchar(20) NOT NULL DEFAULT 'available', \`notes\` text NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_95e9ba0a907346ef7b0d5ca488\` (\`room_id\`, \`bed_number\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`lockers\` (\`id\` int NOT NULL AUTO_INCREMENT, \`room_id\` int NOT NULL, \`locker_number\` varchar(20) NOT NULL, \`status\` varchar(20) NOT NULL DEFAULT 'available', \`notes\` text NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_8bc984d80d58c6909f738d8282\` (\`room_id\`, \`locker_number\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`occupancies\` (\`id\` int NOT NULL AUTO_INCREMENT, \`student_id\` int NOT NULL, \`room_id\` int NOT NULL, \`check_in_date\` date NOT NULL, \`check_out_date\` date NULL, \`billing_start_date\` date NOT NULL, \`billing_end_date\` date NULL, \`check_out_reason\` varchar(100) NULL, \`notes\` text NULL, \`status\` varchar(20) NOT NULL DEFAULT 'active', \`bed_id\` int NULL, \`locker_id\` int NULL, \`stay_type\` varchar(10) NOT NULL DEFAULT 'short', \`responsible_organization_id\` int NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`personal_expenses\` (\`id\` int NOT NULL AUTO_INCREMENT, \`student_id\` int NOT NULL, \`room_id\` int NULL, \`expense_type\` varchar(20) NOT NULL, \`amount\` decimal(10,2) NOT NULL, \`expense_date\` date NOT NULL, \`description\` text NULL, \`recorded_by\` int NULL, \`status\` varchar(20) NOT NULL DEFAULT 'active', \`bill_id\` int NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`bill_items\` (\`id\` int NOT NULL AUTO_INCREMENT, \`bill_id\` int NOT NULL, \`room_expense_id\` int NULL, \`personal_expense_id\` int NULL, \`room_id\` int NULL, \`expense_type\` varchar(20) NULL, \`description\` varchar(200) NULL, \`days\` int NULL, \`total_room_days\` int NULL, \`room_total_amount\` decimal(10,2) NULL, \`student_amount\` decimal(10,2) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`bills\` (\`id\` int NOT NULL AUTO_INCREMENT, \`student_id\` int NOT NULL, \`period_start\` date NOT NULL, \`period_end\` date NOT NULL, \`shared_amount\` decimal(10,2) NOT NULL DEFAULT '0.00', \`personal_amount\` decimal(10,2) NOT NULL DEFAULT '0.00', \`total_amount\` decimal(10,2) NOT NULL DEFAULT '0.00', \`source\` varchar(30) NOT NULL DEFAULT 'batch', \`paid_amount\` decimal(10,2) NOT NULL DEFAULT '0.00', \`outstanding_amount\` decimal(10,2) NOT NULL DEFAULT '0.00', \`status\` varchar(20) NOT NULL DEFAULT 'unpaid', \`cancelled_at\` datetime NULL, \`cancel_reason\` varchar(300) NULL, \`generated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`students\` (\`id\` int NOT NULL AUTO_INCREMENT, \`name\` varchar(50) NOT NULL, \`student_no\` varchar(30) NULL, \`phone\` varchar(20) NULL, \`id_number\` varchar(30) NULL, \`gender\` varchar(10) NULL, \`ethnicity\` varchar(20) NULL, \`emergency_contact\` varchar(50) NULL, \`emergency_phone\` varchar(20) NULL, \`status\` varchar(20) NOT NULL DEFAULT 'active', \`supervisor\` varchar(50) NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`user_id\` int NULL, \`organization_id\` int NULL, UNIQUE INDEX \`IDX_fb3eff90b11bddf7285f9b4e28\` (\`user_id\`), UNIQUE INDEX \`REL_fb3eff90b11bddf7285f9b4e28\` (\`user_id\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`student_wallets\` (\`id\` int NOT NULL AUTO_INCREMENT, \`student_id\` int NOT NULL, \`balance\` decimal(12,2) NOT NULL DEFAULT '0.00', \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_07a434ad1a960d506386754d59\` (\`student_id\`), UNIQUE INDEX \`REL_07a434ad1a960d506386754d59\` (\`student_id\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`student_profiles\` (\`id\` int NOT NULL AUTO_INCREMENT, \`student_id\` int NOT NULL, \`target_college\` varchar(100) NULL, \`target_major\` varchar(100) NULL, \`subject_direction\` varchar(50) NULL, \`grade\` varchar(20) NULL, \`profile_date\` date NULL, \`notes\` text NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_4cedc08d3dc1f2c2da8a12f7a8\` (\`student_id\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`student_enrollments\` (\`id\` int NOT NULL AUTO_INCREMENT, \`student_id\` int NOT NULL, \`course_category\` varchar(50) NULL, \`class_type\` varchar(50) NULL, \`class_name\` varchar(100) NULL, \`head_teacher\` varchar(50) NULL, \`subject_teacher\` varchar(50) NULL, \`start_date\` date NULL, \`end_date\` date NULL, \`status\` varchar(20) NOT NULL DEFAULT 'active', \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`student_ding_mapping\` (\`id\` int NOT NULL AUTO_INCREMENT, \`ding_user_id\` varchar(100) NOT NULL, \`student_id\` int NOT NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_0d1ec47e2f901d37e3b6e56331\` (\`ding_user_id\`), UNIQUE INDEX \`IDX_f9ba15ff04de8ffbd8679ae9db\` (\`student_id\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`result_archives\` (\`id\` int NOT NULL AUTO_INCREMENT, \`student_id\` int NOT NULL, \`culture_final_score\` decimal(5,2) NULL, \`professional_final_score\` decimal(5,2) NULL, \`admission_status\` varchar(50) NULL, \`admitted_college\` varchar(100) NULL, \`admitted_major\` varchar(100) NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_377bba8eb6a027eecd9737d4ed\` (\`student_id\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`operation_logs\` (\`id\` int NOT NULL AUTO_INCREMENT, \`user_id\` int NULL, \`username\` varchar(50) NULL, \`module\` varchar(50) NOT NULL, \`action\` varchar(50) NOT NULL, \`target_id\` int NULL, \`target_type\` varchar(50) NULL, \`detail\` text NULL, \`ip_address\` varchar(50) NULL, \`user_agent\` varchar(500) NULL, \`status\` varchar(20) NULL DEFAULT 'success', \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`notifications\` (\`id\` int NOT NULL AUTO_INCREMENT, \`recipient_id\` int NOT NULL, \`type\` varchar(30) NOT NULL, \`title\` varchar(200) NOT NULL, \`content\` text NULL, \`link\` varchar(500) NULL, \`is_read\` tinyint NOT NULL DEFAULT 0, \`read_at\` datetime NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`learning_records\` (\`id\` int NOT NULL AUTO_INCREMENT, \`student_id\` int NOT NULL, \`record_date\` date NULL, \`record_type\` varchar(50) NULL, \`content\` text NULL, \`follow_up_method\` varchar(50) NULL, \`next_step\` text NULL, \`status\` varchar(20) NOT NULL DEFAULT 'active', \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`financial_operations\` (\`id\` int NOT NULL AUTO_INCREMENT, \`operation_id\` varchar(64) NOT NULL, \`type\` varchar(64) NOT NULL, \`status\` varchar(20) NOT NULL DEFAULT 'running', \`result_json\` text NULL, \`error_message\` varchar(500) NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_f15aa4c89aa57366fdba8a84db\` (\`operation_id\`), UNIQUE INDEX \`IDX_f15aa4c89aa57366fdba8a84db\` (\`operation_id\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`expense_types\` (\`id\` int NOT NULL AUTO_INCREMENT, \`code\` varchar(30) NOT NULL, \`name\` varchar(30) NOT NULL, \`category\` varchar(20) NOT NULL DEFAULT 'room', \`sort_order\` int NOT NULL DEFAULT '0', \`enabled\` tinyint NOT NULL DEFAULT 1, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_36eda3eb0f6740ecf2ba906012\` (\`code\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`exam_scores\` (\`id\` int NOT NULL AUTO_INCREMENT, \`student_id\` int NOT NULL, \`enrollment_id\` int NULL, \`exam_type\` varchar(50) NULL, \`exam_name\` varchar(100) NULL, \`subject\` varchar(50) NULL, \`score\` decimal(5,2) NULL, \`class_avg\` decimal(5,2) NULL, \`rank\` int NULL, \`exam_date\` date NULL, \`status\` varchar(20) NOT NULL DEFAULT 'active', \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`ding_attendance_raw\` (\`id\` int NOT NULL AUTO_INCREMENT, \`ding_user_id\` varchar(100) NOT NULL, \`user_name\` varchar(100) NOT NULL, \`attendance_date\` date NOT NULL, \`ding_id\` varchar(100) NOT NULL, \`check_in_time\` datetime NULL, \`check_out_time\` datetime NULL, \`attendance_type\` varchar(20) NOT NULL, \`time_result\` varchar(20) NOT NULL, \`location_result\` varchar(20) NULL, \`punch_source\` varchar(40) NULL, \`punch_device_name\` varchar(100) NULL, \`punch_device_id\` varchar(100) NULL, \`match_status\` varchar(20) NOT NULL DEFAULT 'unmatched', \`matched_student_id\` int NULL, \`raw_data\` text NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), INDEX \`IDX_d6680d5150f0bfa47dbc1fe96f\` (\`match_status\`), INDEX \`IDX_088de070f537b15ab7da255e5b\` (\`attendance_date\`), UNIQUE INDEX \`IDX_997849bb04ff69149fcf00a8d3\` (\`ding_id\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`deposit_installments\` (\`id\` int NOT NULL AUTO_INCREMENT, \`deposit_id\` int NOT NULL, \`amount\` decimal(10,2) NOT NULL, \`due_date\` date NOT NULL, \`paid_date\` date NULL, \`status\` varchar(20) NOT NULL DEFAULT 'pending', \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`deposits\` (\`id\` int NOT NULL AUTO_INCREMENT, \`student_id\` int NOT NULL, \`amount\` decimal(10,2) NOT NULL DEFAULT '500.00', \`status\` varchar(20) NOT NULL DEFAULT 'paid', \`paid_date\` date NOT NULL, \`refund_date\` date NULL, \`refund_amount\` decimal(10,2) NULL, \`deduction_amount\` decimal(10,2) NOT NULL DEFAULT '0.00', \`deduction_reason\` text NULL, \`notes\` text NULL, \`recorded_by\` int NULL, \`refunded_by\` int NULL, \`refunded_at\` datetime NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`classrooms\` (\`id\` int NOT NULL AUTO_INCREMENT, \`name\` varchar(50) NOT NULL, \`building\` varchar(50) NULL, \`floor\` int NULL, \`capacity\` int NOT NULL DEFAULT '30', \`room_type\` varchar(20) NOT NULL DEFAULT '大', \`status\` varchar(20) NOT NULL DEFAULT 'available', \`notes\` text NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`classroom_rentals\` (\`id\` int NOT NULL AUTO_INCREMENT, \`classroom_id\` int NOT NULL, \`lessor_organization_id\` int NULL, \`lessee_organization_id\` int NULL, \`start_date\` date NOT NULL, \`end_date\` date NOT NULL, \`contract_path\` varchar(255) NULL, \`contract_original_name\` varchar(255) NULL, \`daily_rate\` decimal(10,2) NULL, \`total_amount\` decimal(10,2) NULL, \`status\` varchar(20) NOT NULL DEFAULT 'active', \`notes\` text NULL, \`created_by\` int NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), INDEX \`IDX_b748a951d00b3f0c2090d10397\` (\`classroom_id\`, \`start_date\`, \`end_date\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`classes\` (\`id\` int NOT NULL AUTO_INCREMENT, \`name\` varchar(100) NOT NULL, \`code\` varchar(50) NOT NULL, \`class_type\` varchar(20) NOT NULL, \`start_date\` date NULL, \`end_date\` date NULL, \`status\` varchar(20) NOT NULL DEFAULT 'enrolling', \`head_teacher_id\` int NULL, \`life_teacher_id\` int NULL, \`academic_teacher_id\` int NULL, \`max_students\` int NOT NULL DEFAULT '0', \`notes\` text NULL, \`is_archived\` tinyint NOT NULL DEFAULT 0, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_cf7491878e0fca859943862998\` (\`code\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`class_teacher\` (\`id\` int NOT NULL AUTO_INCREMENT, \`class_id\` int NOT NULL, \`user_id\` int NOT NULL, \`role_type\` varchar(30) NOT NULL, \`subject\` varchar(50) NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_0117e9171e1533ff7b5c63f5d6\` (\`class_id\`, \`user_id\`, \`role_type\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`class_student\` (\`id\` int NOT NULL AUTO_INCREMENT, \`class_id\` int NOT NULL, \`student_id\` int NOT NULL, \`join_date\` date NULL, \`leave_date\` date NULL, \`status\` varchar(10) NOT NULL DEFAULT 'active', \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_b0ed786e05e93dd9bf77189af1\` (\`class_id\`, \`student_id\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`class_schedule\` (\`id\` int NOT NULL AUTO_INCREMENT, \`class_id\` int NULL, \`classroom_id\` int NOT NULL, \`week_day\` int NOT NULL, \`start_time\` varchar(5) NOT NULL, \`end_time\` varchar(5) NOT NULL, \`attendance_advance_minutes\` int NOT NULL DEFAULT '30', \`start_date\` date NOT NULL, \`end_date\` date NOT NULL, \`subject\` varchar(50) NOT NULL, \`teacher_id\` int NULL, \`schedule_type\` varchar(20) NOT NULL DEFAULT 'INTERNAL', \`rental_id\` int NULL, \`status\` varchar(20) NOT NULL DEFAULT 'active', \`notes\` text NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`attendance_records\` (\`id\` int NOT NULL AUTO_INCREMENT, \`student_id\` int NOT NULL, \`class_id\` int NULL, \`schedule_id\` int NULL, \`attendance_session_id\` int NULL, \`attendance_date\` date NOT NULL, \`session\` varchar(20) NOT NULL, \`status\` varchar(20) NOT NULL, \`remark\` varchar(200) NULL, \`source\` varchar(20) NOT NULL DEFAULT 'manual', \`punch_time\` datetime NULL, \`punch_source\` varchar(40) NULL, \`punch_device_name\` varchar(100) NULL, \`punch_device_id\` varchar(100) NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_43ac61c4ffa4117b738dd3a1e4\` (\`attendance_session_id\`, \`student_id\`), INDEX \`IDX_6b8f69a76bea22962e54bd21f5\` (\`student_id\`, \`attendance_date\`), INDEX \`IDX_a8eee7b8a0e0af27e79cb27ccc\` (\`class_id\`, \`attendance_date\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`attendance_sessions\` (\`id\` int NOT NULL AUTO_INCREMENT, \`schedule_id\` int NOT NULL, \`class_id\` int NOT NULL, \`lesson_date\` date NOT NULL, \`status\` varchar(20) NOT NULL DEFAULT 'in_progress', \`started_by\` int NULL, \`started_at\` datetime NULL, \`completed_by\` int NULL, \`completed_at\` datetime NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), UNIQUE INDEX \`IDX_d4288982a2baaa6085cf872990\` (\`schedule_id\`, \`lesson_date\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`attendance_period_configs\` (\`id\` int NOT NULL AUTO_INCREMENT, \`period_key\` varchar(40) NOT NULL, \`label\` varchar(40) NOT NULL, \`start_time\` varchar(5) NOT NULL, \`end_time\` varchar(5) NOT NULL, \`sort_order\` int NOT NULL DEFAULT '0', \`enabled\` tinyint NOT NULL DEFAULT 1, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), INDEX \`IDX_02b29b9018684af3e3837408e0\` (\`sort_order\`), UNIQUE INDEX \`IDX_1cd8e45776b2dd7efb84ad994e\` (\`period_key\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`attendance_devices\` (\`id\` int NOT NULL AUTO_INCREMENT, \`device_sn\` varchar(100) NOT NULL, \`device_name\` varchar(100) NOT NULL, \`classroom_id\` int NOT NULL, \`status\` varchar(20) NOT NULL DEFAULT 'active', \`location\` varchar(200) NULL, \`notes\` text NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), INDEX \`IDX_2d2806b8906e201230afb3376a\` (\`classroom_id\`), UNIQUE INDEX \`IDX_c6835138ea258d1259246dd736\` (\`device_sn\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`archive_attachments\` (\`id\` int NOT NULL AUTO_INCREMENT, \`student_id\` int NOT NULL, \`category\` varchar(50) NULL, \`file_name\` varchar(255) NULL, \`file_path\` varchar(500) NULL, \`file_size\` int NULL, \`mime_type\` varchar(100) NULL, \`status\` varchar(20) NOT NULL DEFAULT 'active', \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`ai_config\` (\`id\` int NOT NULL AUTO_INCREMENT, \`singleton_key\` varchar(20) NOT NULL DEFAULT 'GLOBAL', \`provider\` varchar(50) NOT NULL DEFAULT 'OPENAI', \`base_url\` varchar(500) NULL, \`encrypted_api_key\` text NULL, \`api_key_iv\` varchar(50) NULL, \`api_key_auth_tag\` varchar(50) NULL, \`key_last4\` varchar(4) NULL, \`default_model\` varchar(100) NULL, \`enabled\` tinyint NOT NULL DEFAULT 0, \`timeout_ms\` int NOT NULL DEFAULT '30000', \`verified\` tinyint NOT NULL DEFAULT 0, \`last_tested_at\` datetime NULL, \`last_test_latency_ms\` int NULL, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), UNIQUE INDEX \`uq_ai_config_singleton\` (\`singleton_key\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`integration_config\` (\`id\` int NOT NULL AUTO_INCREMENT, \`type\` varchar(50) NOT NULL, \`sync_resource\` varchar(50) NULL, \`is_sync\` tinyint NOT NULL DEFAULT 0, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`integration_config_detail\` (\`id\` int NOT NULL AUTO_INCREMENT, \`config_id\` int NOT NULL, \`name\` varchar(100) NULL, \`type\` varchar(50) NOT NULL, \`content\` text NULL, \`enable\` tinyint NOT NULL DEFAULT 0, \`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), INDEX \`IDX_a58106c4b876c86a5e085e4f42\` (\`config_id\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`role_permissions\` (\`role_id\` int NOT NULL, \`permission_id\` int NOT NULL, INDEX \`IDX_178199805b901ccd220ab7740e\` (\`role_id\`), INDEX \`IDX_17022daf3f885f7d35423e9971\` (\`permission_id\`), PRIMARY KEY (\`role_id\`, \`permission_id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`CREATE TABLE \`user_roles\` (\`user_id\` int NOT NULL, \`role_id\` int NOT NULL, INDEX \`IDX_87b8888186ca9769c960e92687\` (\`user_id\`), INDEX \`IDX_b23c65e50a758245a33ee35fda\` (\`role_id\`), PRIMARY KEY (\`user_id\`, \`role_id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`ALTER TABLE \`room_expenses\` ADD CONSTRAINT \`FK_7bb1ca73f8161af27e538917a55\` FOREIGN KEY (\`room_id\`) REFERENCES \`rooms\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`beds\` ADD CONSTRAINT \`FK_fd7413faee42749f1b2e8270394\` FOREIGN KEY (\`room_id\`) REFERENCES \`rooms\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`lockers\` ADD CONSTRAINT \`FK_344ae29b9cacbee1e24da7c07ea\` FOREIGN KEY (\`room_id\`) REFERENCES \`rooms\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`occupancies\` ADD CONSTRAINT \`FK_bed301f5a4e2135dd14b55fec0e\` FOREIGN KEY (\`bed_id\`) REFERENCES \`beds\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`occupancies\` ADD CONSTRAINT \`FK_ea80244bd95c8c04334931e39a2\` FOREIGN KEY (\`locker_id\`) REFERENCES \`lockers\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`occupancies\` ADD CONSTRAINT \`FK_3c80232a56303a75ffd544b982f\` FOREIGN KEY (\`responsible_organization_id\`) REFERENCES \`organizations\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`occupancies\` ADD CONSTRAINT \`FK_dc062720596049470b56ce06973\` FOREIGN KEY (\`student_id\`) REFERENCES \`students\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`occupancies\` ADD CONSTRAINT \`FK_9f7acc7567e42dda281ead9a75a\` FOREIGN KEY (\`room_id\`) REFERENCES \`rooms\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`personal_expenses\` ADD CONSTRAINT \`FK_5e5bcfb70705c2c349c74b70912\` FOREIGN KEY (\`student_id\`) REFERENCES \`students\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`bill_items\` ADD CONSTRAINT \`FK_b424156152a3230b034bdb51db4\` FOREIGN KEY (\`bill_id\`) REFERENCES \`bills\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`bills\` ADD CONSTRAINT \`FK_65a6cb602ebcbac1bf7a995e0c9\` FOREIGN KEY (\`student_id\`) REFERENCES \`students\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`students\` ADD CONSTRAINT \`FK_fb3eff90b11bddf7285f9b4e281\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`students\` ADD CONSTRAINT \`FK_9571384818ecf499779d3a9d141\` FOREIGN KEY (\`organization_id\`) REFERENCES \`organizations\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`student_wallets\` ADD CONSTRAINT \`FK_07a434ad1a960d506386754d592\` FOREIGN KEY (\`student_id\`) REFERENCES \`students\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`student_profiles\` ADD CONSTRAINT \`FK_4cedc08d3dc1f2c2da8a12f7a88\` FOREIGN KEY (\`student_id\`) REFERENCES \`students\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`student_enrollments\` ADD CONSTRAINT \`FK_08caafd8a026a19ecf54db0e958\` FOREIGN KEY (\`student_id\`) REFERENCES \`students\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`student_ding_mapping\` ADD CONSTRAINT \`FK_f9ba15ff04de8ffbd8679ae9dbb\` FOREIGN KEY (\`student_id\`) REFERENCES \`students\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`result_archives\` ADD CONSTRAINT \`FK_377bba8eb6a027eecd9737d4ed6\` FOREIGN KEY (\`student_id\`) REFERENCES \`students\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`notifications\` ADD CONSTRAINT \`FK_5332a4daa46fd3f4e6625dd275d\` FOREIGN KEY (\`recipient_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`learning_records\` ADD CONSTRAINT \`FK_61f4664f02d86245e1231493951\` FOREIGN KEY (\`student_id\`) REFERENCES \`students\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`exam_scores\` ADD CONSTRAINT \`FK_925e4f79518c947512cb600b452\` FOREIGN KEY (\`student_id\`) REFERENCES \`students\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`exam_scores\` ADD CONSTRAINT \`FK_b0d812b639f32939ea57b81a89f\` FOREIGN KEY (\`enrollment_id\`) REFERENCES \`student_enrollments\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`ding_attendance_raw\` ADD CONSTRAINT \`FK_2b06491a70540db69e78e57ecf2\` FOREIGN KEY (\`matched_student_id\`) REFERENCES \`students\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`deposit_installments\` ADD CONSTRAINT \`FK_fba3c52b86d51fff34593877ff5\` FOREIGN KEY (\`deposit_id\`) REFERENCES \`deposits\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`deposits\` ADD CONSTRAINT \`FK_ec1b340d2963ed907421696fc33\` FOREIGN KEY (\`student_id\`) REFERENCES \`students\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`classroom_rentals\` ADD CONSTRAINT \`FK_6a0af46fe476070c4c660307641\` FOREIGN KEY (\`classroom_id\`) REFERENCES \`classrooms\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`classroom_rentals\` ADD CONSTRAINT \`FK_40a46e95470ff454ffdcbb1e902\` FOREIGN KEY (\`lessor_organization_id\`) REFERENCES \`organizations\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`classroom_rentals\` ADD CONSTRAINT \`FK_f60533a91f16a331c9388308418\` FOREIGN KEY (\`lessee_organization_id\`) REFERENCES \`organizations\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`class_teacher\` ADD CONSTRAINT \`FK_9b647c8d8894a661dc1dac40361\` FOREIGN KEY (\`class_id\`) REFERENCES \`classes\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`class_teacher\` ADD CONSTRAINT \`FK_a9f0e77d193b015b6d5ca6637f5\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`class_student\` ADD CONSTRAINT \`FK_60674dc4f23b794de0a3560e200\` FOREIGN KEY (\`class_id\`) REFERENCES \`classes\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`class_student\` ADD CONSTRAINT \`FK_451334295b9cf221d55aca7cac1\` FOREIGN KEY (\`student_id\`) REFERENCES \`students\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`class_schedule\` ADD CONSTRAINT \`FK_0aa74ee427967d4c82f298511bc\` FOREIGN KEY (\`class_id\`) REFERENCES \`classes\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`class_schedule\` ADD CONSTRAINT \`FK_c1d5d50c871fdf563be13d6e93a\` FOREIGN KEY (\`classroom_id\`) REFERENCES \`classrooms\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`class_schedule\` ADD CONSTRAINT \`FK_f1e761cac59f2d0a3d7949468c5\` FOREIGN KEY (\`teacher_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`attendance_records\` ADD CONSTRAINT \`FK_dbace05c012526710663f8d8911\` FOREIGN KEY (\`student_id\`) REFERENCES \`students\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`attendance_records\` ADD CONSTRAINT \`FK_cc48ccbd03396874857ab06ac3b\` FOREIGN KEY (\`class_id\`) REFERENCES \`classes\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`attendance_records\` ADD CONSTRAINT \`FK_0dfe6d219c4a7a162ca0f84243c\` FOREIGN KEY (\`schedule_id\`) REFERENCES \`class_schedule\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`attendance_records\` ADD CONSTRAINT \`FK_32a57ba853da6939ceaccf8cfc8\` FOREIGN KEY (\`attendance_session_id\`) REFERENCES \`attendance_sessions\`(\`id\`) ON DELETE SET NULL ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`attendance_sessions\` ADD CONSTRAINT \`FK_107206b64415a644d571d597ca3\` FOREIGN KEY (\`schedule_id\`) REFERENCES \`class_schedule\`(\`id\`) ON DELETE RESTRICT ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`attendance_sessions\` ADD CONSTRAINT \`FK_6fc552e07b31ac92445cd3e21fa\` FOREIGN KEY (\`class_id\`) REFERENCES \`classes\`(\`id\`) ON DELETE RESTRICT ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`attendance_devices\` ADD CONSTRAINT \`FK_2d2806b8906e201230afb3376af\` FOREIGN KEY (\`classroom_id\`) REFERENCES \`classrooms\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`archive_attachments\` ADD CONSTRAINT \`FK_0bc7365c2629d0c6dae8052fc25\` FOREIGN KEY (\`student_id\`) REFERENCES \`students\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`integration_config_detail\` ADD CONSTRAINT \`FK_a58106c4b876c86a5e085e4f42b\` FOREIGN KEY (\`config_id\`) REFERENCES \`integration_config\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`role_permissions\` ADD CONSTRAINT \`FK_178199805b901ccd220ab7740ec\` FOREIGN KEY (\`role_id\`) REFERENCES \`roles\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`);
|
||||
await queryRunner.query(`ALTER TABLE \`role_permissions\` ADD CONSTRAINT \`FK_17022daf3f885f7d35423e9971e\` FOREIGN KEY (\`permission_id\`) REFERENCES \`permissions\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`);
|
||||
await queryRunner.query(`ALTER TABLE \`user_roles\` ADD CONSTRAINT \`FK_87b8888186ca9769c960e926870\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`);
|
||||
await queryRunner.query(`ALTER TABLE \`user_roles\` ADD CONSTRAINT \`FK_b23c65e50a758245a33ee35fda1\` FOREIGN KEY (\`role_id\`) REFERENCES \`roles\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`user_roles\` DROP FOREIGN KEY \`FK_b23c65e50a758245a33ee35fda1\``);
|
||||
await queryRunner.query(`ALTER TABLE \`user_roles\` DROP FOREIGN KEY \`FK_87b8888186ca9769c960e926870\``);
|
||||
await queryRunner.query(`ALTER TABLE \`role_permissions\` DROP FOREIGN KEY \`FK_17022daf3f885f7d35423e9971e\``);
|
||||
await queryRunner.query(`ALTER TABLE \`role_permissions\` DROP FOREIGN KEY \`FK_178199805b901ccd220ab7740ec\``);
|
||||
await queryRunner.query(`ALTER TABLE \`integration_config_detail\` DROP FOREIGN KEY \`FK_a58106c4b876c86a5e085e4f42b\``);
|
||||
await queryRunner.query(`ALTER TABLE \`archive_attachments\` DROP FOREIGN KEY \`FK_0bc7365c2629d0c6dae8052fc25\``);
|
||||
await queryRunner.query(`ALTER TABLE \`attendance_devices\` DROP FOREIGN KEY \`FK_2d2806b8906e201230afb3376af\``);
|
||||
await queryRunner.query(`ALTER TABLE \`attendance_sessions\` DROP FOREIGN KEY \`FK_6fc552e07b31ac92445cd3e21fa\``);
|
||||
await queryRunner.query(`ALTER TABLE \`attendance_sessions\` DROP FOREIGN KEY \`FK_107206b64415a644d571d597ca3\``);
|
||||
await queryRunner.query(`ALTER TABLE \`attendance_records\` DROP FOREIGN KEY \`FK_32a57ba853da6939ceaccf8cfc8\``);
|
||||
await queryRunner.query(`ALTER TABLE \`attendance_records\` DROP FOREIGN KEY \`FK_0dfe6d219c4a7a162ca0f84243c\``);
|
||||
await queryRunner.query(`ALTER TABLE \`attendance_records\` DROP FOREIGN KEY \`FK_cc48ccbd03396874857ab06ac3b\``);
|
||||
await queryRunner.query(`ALTER TABLE \`attendance_records\` DROP FOREIGN KEY \`FK_dbace05c012526710663f8d8911\``);
|
||||
await queryRunner.query(`ALTER TABLE \`class_schedule\` DROP FOREIGN KEY \`FK_f1e761cac59f2d0a3d7949468c5\``);
|
||||
await queryRunner.query(`ALTER TABLE \`class_schedule\` DROP FOREIGN KEY \`FK_c1d5d50c871fdf563be13d6e93a\``);
|
||||
await queryRunner.query(`ALTER TABLE \`class_schedule\` DROP FOREIGN KEY \`FK_0aa74ee427967d4c82f298511bc\``);
|
||||
await queryRunner.query(`ALTER TABLE \`class_student\` DROP FOREIGN KEY \`FK_451334295b9cf221d55aca7cac1\``);
|
||||
await queryRunner.query(`ALTER TABLE \`class_student\` DROP FOREIGN KEY \`FK_60674dc4f23b794de0a3560e200\``);
|
||||
await queryRunner.query(`ALTER TABLE \`class_teacher\` DROP FOREIGN KEY \`FK_a9f0e77d193b015b6d5ca6637f5\``);
|
||||
await queryRunner.query(`ALTER TABLE \`class_teacher\` DROP FOREIGN KEY \`FK_9b647c8d8894a661dc1dac40361\``);
|
||||
await queryRunner.query(`ALTER TABLE \`classroom_rentals\` DROP FOREIGN KEY \`FK_f60533a91f16a331c9388308418\``);
|
||||
await queryRunner.query(`ALTER TABLE \`classroom_rentals\` DROP FOREIGN KEY \`FK_40a46e95470ff454ffdcbb1e902\``);
|
||||
await queryRunner.query(`ALTER TABLE \`classroom_rentals\` DROP FOREIGN KEY \`FK_6a0af46fe476070c4c660307641\``);
|
||||
await queryRunner.query(`ALTER TABLE \`deposits\` DROP FOREIGN KEY \`FK_ec1b340d2963ed907421696fc33\``);
|
||||
await queryRunner.query(`ALTER TABLE \`deposit_installments\` DROP FOREIGN KEY \`FK_fba3c52b86d51fff34593877ff5\``);
|
||||
await queryRunner.query(`ALTER TABLE \`ding_attendance_raw\` DROP FOREIGN KEY \`FK_2b06491a70540db69e78e57ecf2\``);
|
||||
await queryRunner.query(`ALTER TABLE \`exam_scores\` DROP FOREIGN KEY \`FK_b0d812b639f32939ea57b81a89f\``);
|
||||
await queryRunner.query(`ALTER TABLE \`exam_scores\` DROP FOREIGN KEY \`FK_925e4f79518c947512cb600b452\``);
|
||||
await queryRunner.query(`ALTER TABLE \`learning_records\` DROP FOREIGN KEY \`FK_61f4664f02d86245e1231493951\``);
|
||||
await queryRunner.query(`ALTER TABLE \`notifications\` DROP FOREIGN KEY \`FK_5332a4daa46fd3f4e6625dd275d\``);
|
||||
await queryRunner.query(`ALTER TABLE \`result_archives\` DROP FOREIGN KEY \`FK_377bba8eb6a027eecd9737d4ed6\``);
|
||||
await queryRunner.query(`ALTER TABLE \`student_ding_mapping\` DROP FOREIGN KEY \`FK_f9ba15ff04de8ffbd8679ae9dbb\``);
|
||||
await queryRunner.query(`ALTER TABLE \`student_enrollments\` DROP FOREIGN KEY \`FK_08caafd8a026a19ecf54db0e958\``);
|
||||
await queryRunner.query(`ALTER TABLE \`student_profiles\` DROP FOREIGN KEY \`FK_4cedc08d3dc1f2c2da8a12f7a88\``);
|
||||
await queryRunner.query(`ALTER TABLE \`student_wallets\` DROP FOREIGN KEY \`FK_07a434ad1a960d506386754d592\``);
|
||||
await queryRunner.query(`ALTER TABLE \`students\` DROP FOREIGN KEY \`FK_9571384818ecf499779d3a9d141\``);
|
||||
await queryRunner.query(`ALTER TABLE \`students\` DROP FOREIGN KEY \`FK_fb3eff90b11bddf7285f9b4e281\``);
|
||||
await queryRunner.query(`ALTER TABLE \`bills\` DROP FOREIGN KEY \`FK_65a6cb602ebcbac1bf7a995e0c9\``);
|
||||
await queryRunner.query(`ALTER TABLE \`bill_items\` DROP FOREIGN KEY \`FK_b424156152a3230b034bdb51db4\``);
|
||||
await queryRunner.query(`ALTER TABLE \`personal_expenses\` DROP FOREIGN KEY \`FK_5e5bcfb70705c2c349c74b70912\``);
|
||||
await queryRunner.query(`ALTER TABLE \`occupancies\` DROP FOREIGN KEY \`FK_9f7acc7567e42dda281ead9a75a\``);
|
||||
await queryRunner.query(`ALTER TABLE \`occupancies\` DROP FOREIGN KEY \`FK_dc062720596049470b56ce06973\``);
|
||||
await queryRunner.query(`ALTER TABLE \`occupancies\` DROP FOREIGN KEY \`FK_3c80232a56303a75ffd544b982f\``);
|
||||
await queryRunner.query(`ALTER TABLE \`occupancies\` DROP FOREIGN KEY \`FK_ea80244bd95c8c04334931e39a2\``);
|
||||
await queryRunner.query(`ALTER TABLE \`occupancies\` DROP FOREIGN KEY \`FK_bed301f5a4e2135dd14b55fec0e\``);
|
||||
await queryRunner.query(`ALTER TABLE \`lockers\` DROP FOREIGN KEY \`FK_344ae29b9cacbee1e24da7c07ea\``);
|
||||
await queryRunner.query(`ALTER TABLE \`beds\` DROP FOREIGN KEY \`FK_fd7413faee42749f1b2e8270394\``);
|
||||
await queryRunner.query(`ALTER TABLE \`room_expenses\` DROP FOREIGN KEY \`FK_7bb1ca73f8161af27e538917a55\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_b23c65e50a758245a33ee35fda\` ON \`user_roles\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_87b8888186ca9769c960e92687\` ON \`user_roles\``);
|
||||
await queryRunner.query(`DROP TABLE \`user_roles\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_17022daf3f885f7d35423e9971\` ON \`role_permissions\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_178199805b901ccd220ab7740e\` ON \`role_permissions\``);
|
||||
await queryRunner.query(`DROP TABLE \`role_permissions\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_a58106c4b876c86a5e085e4f42\` ON \`integration_config_detail\``);
|
||||
await queryRunner.query(`DROP TABLE \`integration_config_detail\``);
|
||||
await queryRunner.query(`DROP TABLE \`integration_config\``);
|
||||
await queryRunner.query(`DROP INDEX \`uq_ai_config_singleton\` ON \`ai_config\``);
|
||||
await queryRunner.query(`DROP TABLE \`ai_config\``);
|
||||
await queryRunner.query(`DROP TABLE \`archive_attachments\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_c6835138ea258d1259246dd736\` ON \`attendance_devices\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_2d2806b8906e201230afb3376a\` ON \`attendance_devices\``);
|
||||
await queryRunner.query(`DROP TABLE \`attendance_devices\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_1cd8e45776b2dd7efb84ad994e\` ON \`attendance_period_configs\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_02b29b9018684af3e3837408e0\` ON \`attendance_period_configs\``);
|
||||
await queryRunner.query(`DROP TABLE \`attendance_period_configs\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_d4288982a2baaa6085cf872990\` ON \`attendance_sessions\``);
|
||||
await queryRunner.query(`DROP TABLE \`attendance_sessions\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_a8eee7b8a0e0af27e79cb27ccc\` ON \`attendance_records\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_6b8f69a76bea22962e54bd21f5\` ON \`attendance_records\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_43ac61c4ffa4117b738dd3a1e4\` ON \`attendance_records\``);
|
||||
await queryRunner.query(`DROP TABLE \`attendance_records\``);
|
||||
await queryRunner.query(`DROP TABLE \`class_schedule\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_b0ed786e05e93dd9bf77189af1\` ON \`class_student\``);
|
||||
await queryRunner.query(`DROP TABLE \`class_student\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_0117e9171e1533ff7b5c63f5d6\` ON \`class_teacher\``);
|
||||
await queryRunner.query(`DROP TABLE \`class_teacher\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_cf7491878e0fca859943862998\` ON \`classes\``);
|
||||
await queryRunner.query(`DROP TABLE \`classes\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_b748a951d00b3f0c2090d10397\` ON \`classroom_rentals\``);
|
||||
await queryRunner.query(`DROP TABLE \`classroom_rentals\``);
|
||||
await queryRunner.query(`DROP TABLE \`classrooms\``);
|
||||
await queryRunner.query(`DROP TABLE \`deposits\``);
|
||||
await queryRunner.query(`DROP TABLE \`deposit_installments\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_997849bb04ff69149fcf00a8d3\` ON \`ding_attendance_raw\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_088de070f537b15ab7da255e5b\` ON \`ding_attendance_raw\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_d6680d5150f0bfa47dbc1fe96f\` ON \`ding_attendance_raw\``);
|
||||
await queryRunner.query(`DROP TABLE \`ding_attendance_raw\``);
|
||||
await queryRunner.query(`DROP TABLE \`exam_scores\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_36eda3eb0f6740ecf2ba906012\` ON \`expense_types\``);
|
||||
await queryRunner.query(`DROP TABLE \`expense_types\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_f15aa4c89aa57366fdba8a84db\` ON \`financial_operations\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_f15aa4c89aa57366fdba8a84db\` ON \`financial_operations\``);
|
||||
await queryRunner.query(`DROP TABLE \`financial_operations\``);
|
||||
await queryRunner.query(`DROP TABLE \`learning_records\``);
|
||||
await queryRunner.query(`DROP TABLE \`notifications\``);
|
||||
await queryRunner.query(`DROP TABLE \`operation_logs\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_377bba8eb6a027eecd9737d4ed\` ON \`result_archives\``);
|
||||
await queryRunner.query(`DROP TABLE \`result_archives\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_f9ba15ff04de8ffbd8679ae9db\` ON \`student_ding_mapping\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_0d1ec47e2f901d37e3b6e56331\` ON \`student_ding_mapping\``);
|
||||
await queryRunner.query(`DROP TABLE \`student_ding_mapping\``);
|
||||
await queryRunner.query(`DROP TABLE \`student_enrollments\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_4cedc08d3dc1f2c2da8a12f7a8\` ON \`student_profiles\``);
|
||||
await queryRunner.query(`DROP TABLE \`student_profiles\``);
|
||||
await queryRunner.query(`DROP INDEX \`REL_07a434ad1a960d506386754d59\` ON \`student_wallets\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_07a434ad1a960d506386754d59\` ON \`student_wallets\``);
|
||||
await queryRunner.query(`DROP TABLE \`student_wallets\``);
|
||||
await queryRunner.query(`DROP INDEX \`REL_fb3eff90b11bddf7285f9b4e28\` ON \`students\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_fb3eff90b11bddf7285f9b4e28\` ON \`students\``);
|
||||
await queryRunner.query(`DROP TABLE \`students\``);
|
||||
await queryRunner.query(`DROP TABLE \`bills\``);
|
||||
await queryRunner.query(`DROP TABLE \`bill_items\``);
|
||||
await queryRunner.query(`DROP TABLE \`personal_expenses\``);
|
||||
await queryRunner.query(`DROP TABLE \`occupancies\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_8bc984d80d58c6909f738d8282\` ON \`lockers\``);
|
||||
await queryRunner.query(`DROP TABLE \`lockers\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_95e9ba0a907346ef7b0d5ca488\` ON \`beds\``);
|
||||
await queryRunner.query(`DROP TABLE \`beds\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_7e27c3b62c681fbe3e2322535f\` ON \`organizations\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_0db5eda192bf60a02bd41931f8\` ON \`organizations\``);
|
||||
await queryRunner.query(`DROP TABLE \`organizations\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_8f7c6fa4c469bab1a06fe3e49f\` ON \`rooms\``);
|
||||
await queryRunner.query(`DROP TABLE \`rooms\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_050485162d4fe47bd3cfd7dedb\` ON \`room_expenses\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_050485162d4fe47bd3cfd7dedb\` ON \`room_expenses\``);
|
||||
await queryRunner.query(`DROP TABLE \`room_expenses\``);
|
||||
await queryRunner.query(`DROP TABLE \`sync_logs\``);
|
||||
await queryRunner.query(`DROP TABLE \`sync_state\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_fe0bb3f6520ee0469504521e71\` ON \`users\``);
|
||||
await queryRunner.query(`DROP TABLE \`users\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_f6d54f95c31b73fb1bdd8e91d0\` ON \`roles\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_648e3f5447f725579d7d4ffdfb\` ON \`roles\``);
|
||||
await queryRunner.query(`DROP TABLE \`roles\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_8dad765629e83229da6feda1c1\` ON \`permissions\``);
|
||||
await queryRunner.query(`DROP TABLE \`permissions\``);
|
||||
await queryRunner.query(`DROP INDEX \`IDX_680bbd0275ac5e06c179f9b84c\` ON \`wallet_transactions\``);
|
||||
await queryRunner.query(`DROP TABLE \`wallet_transactions\``);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user