no message

This commit is contained in:
Kittapath 2024-02-22 17:43:26 +07:00
parent 2ced1ce127
commit 5bdd2c226e

View file

@ -1,18 +1,19 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class CreateSalaryPeriodTable1708585607075 implements MigrationInterface {
name = 'CreateSalaryPeriodTable1708585607075'
name = "CreateSalaryPeriodTable1708585607075";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`salaryPeriod\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`period\` varchar(255) NOT NULL COMMENT 'ประเภทผัง (SPECIAL->รอบพิเศษ,APR->รอบเมษายน,OCT->รอบตุลาคม)', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`effectiveDate\` datetime NULL COMMENT 'วันที่มีผลบังคับใช้', \`status\` varchar(255) NOT NULL COMMENT 'สถานะ' DEFAULT 'PENDING', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`salarys\` ADD CONSTRAINT \`FK_fa211557e2cbee0bb3bbef363f2\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`salarys\` ADD CONSTRAINT \`FK_683719e5363cc977da591556731\` FOREIGN KEY (\`posLevelId\`) REFERENCES \`posLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`salarys\` DROP FOREIGN KEY \`FK_683719e5363cc977da591556731\``);
await queryRunner.query(`ALTER TABLE \`salarys\` DROP FOREIGN KEY \`FK_fa211557e2cbee0bb3bbef363f2\``);
await queryRunner.query(`DROP TABLE \`salaryPeriod\``);
}
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE \`salaryPeriod\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`period\` varchar(255) NOT NULL COMMENT 'ประเภทผัง (SPECIAL->รอบพิเศษ,APR->รอบเมษายน,OCT->รอบตุลาคม)', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`effectiveDate\` datetime NULL COMMENT 'วันที่มีผลบังคับใช้', \`status\` varchar(255) NOT NULL COMMENT 'สถานะ' DEFAULT 'PENDING', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`,
);
// await queryRunner.query(`ALTER TABLE \`salarys\` ADD CONSTRAINT \`FK_fa211557e2cbee0bb3bbef363f2\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
// await queryRunner.query(`ALTER TABLE \`salarys\` ADD CONSTRAINT \`FK_683719e5363cc977da591556731\` FOREIGN KEY (\`posLevelId\`) REFERENCES \`posLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
// await queryRunner.query(`ALTER TABLE \`salarys\` DROP FOREIGN KEY \`FK_683719e5363cc977da591556731\``);
// await queryRunner.query(`ALTER TABLE \`salarys\` DROP FOREIGN KEY \`FK_fa211557e2cbee0bb3bbef363f2\``);
await queryRunner.query(`DROP TABLE \`salaryPeriod\``);
}
}