Migration add fields isDeleted #210

This commit is contained in:
harid 2026-02-12 11:47:53 +07:00
parent 3c9e3a1bb6
commit 65e3740cc2
82 changed files with 499 additions and 180 deletions

View file

@ -0,0 +1,74 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddFieldsIsDeleted1770870836370 implements MigrationInterface {
name = 'AddFieldsIsDeleted1770870836370'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileCertificateHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileCertificate\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileInsigniaHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileInsignia\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileHonorHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileHonor\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileAssessmentHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileAssessment\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileLeave\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileLeaveHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileDutyHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileDuty\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileNopaidHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileNopaid\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileDisciplineHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileChangeNameHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileChangeName\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileEducationHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileEducation\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileAbilityHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileAbility\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileOther\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileChildrenHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileChildren\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileAssistanceHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileAssistance\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileSalaryBackup\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileSalaryBackup\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileAssistance\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileAssistanceHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileChildren\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileChildrenHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileOther\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileAbility\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileAbilityHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileEducation\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileEducationHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileChangeName\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileChangeNameHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileDisciplineHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileNopaid\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileNopaidHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileDuty\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileDutyHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileLeaveHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileLeave\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileAssessment\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileAssessmentHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileHonor\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileHonorHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileInsignia\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileInsigniaHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileCertificate\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileCertificateHistory\` DROP COLUMN \`isDeleted\``);
}
}