This commit is contained in:
mamoss 2025-03-25 11:14:01 +07:00
parent 0ab8aa4f8b
commit 9e1ebf6de1
161 changed files with 1636 additions and 9455 deletions

View file

@ -49,7 +49,7 @@ export class OrganizationUnauthorizeController extends Controller {
}
return result;
}
/**
* API (unauthorize)
*
@ -1319,59 +1319,59 @@ export class OrganizationUnauthorizeController extends Controller {
return new HttpSuccess(formattedResults);
}
// @Patch("retirement")
// public async updateStatusRetirement(
// @Body()
// body: {
// data: {
// profileId: string;
// }[];
// },
// ) {
// let profiles: Profile[] = [];
// let _null: any = null;
// await Promise.all(
// body.data.map(async (item) => {
// const _profile = await this.profileRepo.findOneBy({ id: item.profileId });
// if (!_profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
// _profile.isRetirement = true;
// _profile.isLeave = true;
// _profile.leaveType = "RETIRE";
// _profile.leaveDate = new Date();
// _profile.dateLeave = new Date();
// _profile.lastUpdatedAt = new Date();
// profiles.push(_profile);
// })
// );
// await this.profileRepo.save(profiles);
// return new HttpSuccess();
// }
@Patch("retirement")
public async updateStatusRetirement(
@Body()
body: {
data: {
profileId: string;
}[];
},
) {
let profiles: Profile[] = [];
let _null: any = null;
await Promise.all(
body.data.map(async (item) => {
const _profile = await this.profileRepo.findOneBy({ id: item.profileId });
if (!_profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
_profile.isRetirement = true;
_profile.isLeave = true;
_profile.leaveType = "RETIRE";
_profile.leaveDate = new Date();
_profile.dateLeave = new Date();
_profile.lastUpdatedAt = new Date();
profiles.push(_profile);
}),
);
await this.profileRepo.save(profiles);
return new HttpSuccess();
}
// @Patch("retirement-employee")
// public async updateStatusRetirementEmp(
// @Body()
// body: {
// data: {
// profileId: string;
// }[];
// },
// ) {
// let profiles: ProfileEmployee[] = [];
// let _null: any = null;
// await Promise.all(
// body.data.map(async (item) => {
// const _profile = await this.profileEmpRepo.findOneBy({ id: item.profileId });
// if (!_profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
// _profile.isRetirement = true;
// _profile.isLeave = true;
// _profile.leaveType = "RETIRE";
// _profile.leaveDate = new Date();
// _profile.dateLeave = new Date();
// _profile.lastUpdatedAt = new Date();
// profiles.push(_profile);
// })
// );
// await this.profileEmpRepo.save(profiles);
// return new HttpSuccess();
// }
@Patch("retirement-employee")
public async updateStatusRetirementEmp(
@Body()
body: {
data: {
profileId: string;
}[];
},
) {
let profiles: ProfileEmployee[] = [];
let _null: any = null;
await Promise.all(
body.data.map(async (item) => {
const _profile = await this.profileEmpRepo.findOneBy({ id: item.profileId });
if (!_profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
_profile.isRetirement = true;
_profile.isLeave = true;
_profile.leaveType = "RETIRE";
_profile.leaveDate = new Date();
_profile.dateLeave = new Date();
_profile.lastUpdatedAt = new Date();
profiles.push(_profile);
}),
);
await this.profileEmpRepo.save(profiles);
return new HttpSuccess();
}
}

View file

@ -1,36 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class Start1706268166485 implements MigrationInterface {
name = 'Start1706268166485'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`entity_base\` (\`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', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`orgChild4\` (\`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', \`orgChild4Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ' DEFAULT 'string', \`orgChild4ShortName\` varchar(16) NULL COMMENT 'ชื่อย่อส่วนราชการ' DEFAULT 'string', \`orgChild4Code\` varchar(8) NULL COMMENT 'รหัสส่วนราชการ' DEFAULT 'string', \`orgChild4Rank\` enum ('DEPARTMENT', 'OFFICE', 'DIVISION', 'SECTION') NULL COMMENT 'ระดับส่วนราชการ', \`orgChild4Order\` int NULL COMMENT 'ลำดับที่ของส่วนราชการภายใน Child เดียวกัน', \`orgChild4PhoneEx\` varchar(64) NULL COMMENT 'หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก', \`orgChild4PhoneIn\` varchar(64) NULL COMMENT 'หมายเลขโทรศัพท์ที่ติดต่อจากภายใน', \`orgChild4Fax\` varchar(64) NULL COMMENT 'หมายเลขโทรสาร', \`orgRootId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`orgChild1Id\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`orgChild2Id\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`orgChild3Id\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`orgRevisionId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`isAncestorDNA\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`orgChild3\` (\`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', \`orgChild3Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ' DEFAULT 'string', \`orgChild3ShortName\` varchar(16) NULL COMMENT 'ชื่อย่อส่วนราชการ' DEFAULT 'string', \`orgChild3Code\` varchar(8) NULL COMMENT 'รหัสส่วนราชการ' DEFAULT 'string', \`orgChild3Rank\` enum ('DEPARTMENT', 'OFFICE', 'DIVISION', 'SECTION') NULL COMMENT 'ระดับส่วนราชการ', \`orgChild3Order\` int NULL COMMENT 'ลำดับที่ของส่วนราชการภายใน Child เดียวกัน', \`orgChild3PhoneEx\` varchar(64) NULL COMMENT 'หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก', \`orgChild3PhoneIn\` varchar(64) NULL COMMENT 'หมายเลขโทรศัพท์ที่ติดต่อจากภายใน', \`orgChild3Fax\` varchar(64) NULL COMMENT 'หมายเลขโทรสาร', \`orgRootId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`orgChild1Id\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`orgChild2Id\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`orgRevisionId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`isAncestorDNA\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`orgChild2\` (\`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', \`orgChild2Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ' DEFAULT 'string', \`orgChild2ShortName\` varchar(16) NULL COMMENT 'ชื่อย่อส่วนราชการ' DEFAULT 'string', \`orgChild2Code\` varchar(8) NULL COMMENT 'รหัสส่วนราชการ' DEFAULT 'string', \`orgChild2Rank\` enum ('DEPARTMENT', 'OFFICE', 'DIVISION', 'SECTION') NULL COMMENT 'ระดับส่วนราชการ', \`orgChild2Order\` int NULL COMMENT 'ลำดับที่ของส่วนราชการภายใน Child เดียวกัน', \`orgChild2PhoneEx\` varchar(64) NULL COMMENT 'หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก', \`orgChild2PhoneIn\` varchar(64) NULL COMMENT 'หมายเลขโทรศัพท์ที่ติดต่อจากภายใน', \`orgChild2Fax\` varchar(64) NULL COMMENT 'หมายเลขโทรสาร', \`orgRootId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`orgChild1Id\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`orgRevisionId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`isAncestorDNA\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`orgChild1\` (\`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', \`orgChild1Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ' DEFAULT 'string', \`orgChild1ShortName\` varchar(16) NULL COMMENT 'ชื่อย่อส่วนราชการ' DEFAULT 'string', \`orgChild1Code\` varchar(8) NULL COMMENT 'รหัสส่วนราชการ' DEFAULT 'string', \`orgChild1Rank\` enum ('DEPARTMENT', 'OFFICE', 'DIVISION', 'SECTION') NULL COMMENT 'ระดับส่วนราชการ', \`orgChild1Order\` int NULL COMMENT 'ลำดับที่ของส่วนราชการภายใน Child เดียวกัน', \`orgChild1PhoneEx\` varchar(64) NULL COMMENT 'หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก', \`orgChild1PhoneIn\` varchar(64) NULL COMMENT 'หมายเลขโทรศัพท์ที่ติดต่อจากภายใน', \`orgChild1Fax\` varchar(64) NULL COMMENT 'หมายเลขโทรสาร', \`orgRootId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`orgRevisionId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`isAncestorDNA\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`orgRevision\` (\`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', \`orgRevisionId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`orgRevisionName\` varchar(255) NOT NULL DEFAULT 'string', \`orgRevisionIsCurrent\` tinyint NULL DEFAULT 0, \`orgRevisionCreatedAt\` datetime NULL, \`orgRevisionIsDraft\` tinyint NULL DEFAULT 0, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`orgRoot\` (\`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', \`orgRootName\` varchar(255) NULL COMMENT 'ชื่อหน่วยงาน' DEFAULT 'string', \`orgRootShortName\` varchar(16) NULL COMMENT 'ชื่อย่อหน่วยงาน' DEFAULT 'string', \`orgRootCode\` varchar(8) NULL COMMENT 'รหัสหน่วยงาน' DEFAULT 'string', \`orgRootRank\` enum ('DEPARTMENT', 'OFFICE', 'DIVISION', 'SECTION') NULL COMMENT 'ระดับของหน่วยงาน' DEFAULT 'DEPARTMENT', \`orgRootOrder\` int NULL COMMENT 'ลำดับที่ของหน่วยงาน', \`orgRootPhoneEx\` varchar(64) NULL COMMENT 'หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก', \`orgRootPhoneIn\` varchar(64) NULL COMMENT 'หมายเลขโทรศัพท์ที่ติดต่อจากภายใน', \`orgRootFax\` varchar(64) NULL COMMENT 'หมายเลขโทรสาร', \`isAncestorDNA\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`orgRevisionId\` varchar(36) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_36291e45193793ac8730d5b9ff4\` FOREIGN KEY (\`orgChild3Id\`) REFERENCES \`orgChild3\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_abe35eefd8fb2bf682542c57b5e\` FOREIGN KEY (\`orgChild2Id\`) REFERENCES \`orgChild2\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD CONSTRAINT \`FK_b3e512809e7e8dea0a6a1c0d95f\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD CONSTRAINT \`FK_9481ca31027bf02594ed533b765\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD CONSTRAINT \`FK_b9d787230c285dcd0ba4c63d33b\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP FOREIGN KEY \`FK_b9d787230c285dcd0ba4c63d33b\``);
await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP FOREIGN KEY \`FK_9481ca31027bf02594ed533b765\``);
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP FOREIGN KEY \`FK_b3e512809e7e8dea0a6a1c0d95f\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_abe35eefd8fb2bf682542c57b5e\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_36291e45193793ac8730d5b9ff4\``);
await queryRunner.query(`DROP TABLE \`orgRoot\``);
await queryRunner.query(`DROP TABLE \`orgRevision\``);
await queryRunner.query(`DROP TABLE \`orgChild1\``);
await queryRunner.query(`DROP TABLE \`orgChild2\``);
await queryRunner.query(`DROP TABLE \`orgChild3\``);
await queryRunner.query(`DROP TABLE \`orgChild4\``);
await queryRunner.query(`DROP TABLE \`entity_base\``);
}
}

View file

@ -1,20 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableOrgDeleteIsNormal11706270464847 implements MigrationInterface {
name = 'UpdateTableOrgDeleteIsNormal11706270464847'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP FOREIGN KEY \`FK_b9d787230c285dcd0ba4c63d33b\``);
await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP COLUMN \`orgRevisionId\``);
await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD \`orgRevisionId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD CONSTRAINT \`FK_b9d787230c285dcd0ba4c63d33b\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP FOREIGN KEY \`FK_b9d787230c285dcd0ba4c63d33b\``);
await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP COLUMN \`orgRevisionId\``);
await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD \`orgRevisionId\` varchar(36) NULL`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD CONSTRAINT \`FK_b9d787230c285dcd0ba4c63d33b\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}

View file

@ -1,14 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableOrgRevisionRemoveOrgRevisionId1706275475806 implements MigrationInterface {
name = 'UpdateTableOrgRevisionRemoveOrgRevisionId1706275475806'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`orgRevision\` DROP COLUMN \`orgRevisionId\``);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`orgRevision\` ADD \`orgRevisionId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
}
}

View file

@ -1,14 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableOrgRevisionAddOrgPublishDate1706511716494 implements MigrationInterface {
name = 'UpdateTableOrgRevisionAddOrgPublishDate1706511716494'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`orgRevision\` ADD \`orgPublishDate\` datetime NULL COMMENT 'เวลาเผยแพร่'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`orgRevision\` DROP COLUMN \`orgPublishDate\``);
}
}

View file

@ -1,20 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTablePosLevel1706599465238 implements MigrationInterface {
name = 'AddTablePosLevel1706599465238'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`posExecutive\` (\`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', \`posExecutiveName\` varchar(255) NULL COMMENT 'ชื่อตำแหน่งทางการบริหาร' DEFAULT 'string', \`posExecutivePriority\` int NULL COMMENT 'ลำดับความสำคัญ', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`posLevel\` (\`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', \`posLevelName\` varchar(255) NULL COMMENT 'ชื่อระดับตำแหน่ง' DEFAULT 'string', \`posLevelRank\` int NULL COMMENT 'ระดับของระดับตำแหน่ง', \`posLevelAuthority\` enum ('HEAD', 'DEPUTY', 'GOVERNOR') NULL COMMENT 'ผู้มีอำนาจสั่งบรรจุของระดับนี้ head = หัวหน้าหน่วยงาน , deputy = ปลัด , governor = ผู้ว่าฯ', \`posTypeId\` varchar(40) NOT NULL COMMENT 'เป็นระดับของประเภทตำแหน่งใด' DEFAULT '00000000-0000-0000-0000-000000000000', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`posType\` (\`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', \`posTypeName\` varchar(255) NULL COMMENT 'ชื่อประเภทตำแหน่ง (ทั่วไป วิชาการ อำนวยการ บริหาร)' DEFAULT 'string', \`posTypeRank\` int NULL COMMENT 'ระดับของประเภทตำแหน่ง ไว้ใช้ระบุว่าประเภทตำแหน่งนี้อยู่ระดับสูงหรือต่ำกว่ากัน โดย 1 = ต่ำกว่า , มากกว่า 1 = สูงกว่า ทั่วไป = 1 วิชาการ = 2 อำนวยการ = 3 บริหาร = 4', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`posLevel\` ADD CONSTRAINT \`FK_66caa3d974b67a8a8b343d029b2\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posLevel\` DROP FOREIGN KEY \`FK_66caa3d974b67a8a8b343d029b2\``);
await queryRunner.query(`DROP TABLE \`posType\``);
await queryRunner.query(`DROP TABLE \`posLevel\``);
await queryRunner.query(`DROP TABLE \`posExecutive\``);
}
}

View file

@ -1,18 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTablePosMaster1706684320055 implements MigrationInterface {
name = 'AddTablePosMaster1706684320055'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`posMaster\` (\`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', \`posMasterNoPrefix\` varchar(16) NULL COMMENT 'Prefix นำหน้าเลขที่ตำแหน่ง เป็น Optional (ไม่ใช่อักษรย่อของหน่วยงาน/ส่วนราชการ)' DEFAULT 'string', \`posMasterNo\` varchar(16) NULL COMMENT 'เลขที่ตำแหน่ง เป็นตัวเลข' DEFAULT 'string', \`posMasterNoSuffix\` varchar(16) NULL COMMENT 'Suffix หลังเลขที่ตำแหน่ง เช่น ช.' DEFAULT 'string', \`posMasterCreatedAt\` datetime NULL COMMENT 'วัน-เวลาที่สร้าง', \`ancestorDNA\` varchar(40) NULL COMMENT 'รหัส DNA ใช้ในกรณีที่มีการทำสำเนาโครงสร้างและตำแหน่ง ตำแหน่งที่ทำสำเนามากับตำแหน่งเก่าจะต้องมี DNA เดียวกัน เพื่อให้ track ประวัติการแก้ไขตำแหน่งย้อนหลังได้' DEFAULT 'string', \`posMasterOrder\` int NULL COMMENT 'ลำดับที่แสดงผล', \`posMasterPriority\` int NULL COMMENT 'ลำดับความสำคัญ', \`posMasterLine\` enum ('MAIN', 'SUPPORT') NULL COMMENT 'สายงานในอัตรากำลัง (หลัก / สนับสนุน) คนละฟิลด์กับสายงานของตำแหน่ง', \`orgRootId\` varchar(40) NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`orgChild1Id\` varchar(40) NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`orgChild2Id\` varchar(40) NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`orgChild3Id\` varchar(40) NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`orgChild4Id\` varchar(40) NULL DEFAULT '00000000-0000-0000-0000-000000000000', \`profileIdCurrentHolder\` varchar(40) NULL COMMENT 'คนครองปัจจุบัน เมื่อทำสำเนาโครงสร้างและตำแหน่งพร้อมกับคนครองมา คนครองจะอยู่ในฟิลด์นี้' DEFAULT 'string', \`profileIdNextHolder\` varchar(40) NULL COMMENT 'คนที่กำลังจะมาครอง ตอนปรับโครงสร้าง ถ้าเลือกให้ใครมาครอง ProfileId ของคนนั้นจะมาอยู่ในช่องนี้ รวมทั้งตอนเลือกตำแหน่งเพื่อบรรจุ แต่งตั้ง เลื่อน ย้าย ในระบบบรรจุแต่งตั้งด้วย' DEFAULT 'string', \`orgRevisionId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`position\` (\`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', \`positionName\` varchar(255) NULL COMMENT 'ชื่อตำแหน่งในสายงาน (ชื่อตำแหน่ง)' DEFAULT 'string', \`positionField\` varchar(45) NULL COMMENT 'สายงาน' DEFAULT 'string', \`posTypeId\` varchar(40) NOT NULL COMMENT 'ประเภทตำแหน่ง' DEFAULT '00000000-0000-0000-0000-000000000000', \`posLevelId\` varchar(40) NOT NULL COMMENT 'ระดับตำแหน่ง' DEFAULT '00000000-0000-0000-0000-000000000000', \`posExecutiveId\` varchar(40) NULL COMMENT 'ตำแหน่งทางการบริหาร' DEFAULT '00000000-0000-0000-0000-000000000000', \`positionExecutiveField\` varchar(255) NULL COMMENT 'ด้านทางการบริหาร' DEFAULT 'string', \`positionArea\` varchar(255) NULL COMMENT 'ด้าน/สาขา' DEFAULT 'string', \`positionIsSelected\` tinyint NULL COMMENT 'เป็นตำแหน่งที่ถูกเลือกในรอบนั้นๆ หรือไม่?', \`posMasterId\` varchar(40) NOT NULL COMMENT 'เชื่อมโยงกับตารางเลขที่ตำแหน่ง' DEFAULT '00000000-0000-0000-0000-000000000000', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`posDict\` (\`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', \`posDictName\` varchar(255) NULL COMMENT 'ชื่อตำแหน่งในสายงาน (ชื่อตำแหน่ง)' DEFAULT 'string', \`posDictField\` varchar(255) NULL COMMENT 'สายงาน' DEFAULT 'string', \`posTypeId\` varchar(40) NOT NULL COMMENT 'ตำแหน่งประเภท' DEFAULT '00000000-0000-0000-0000-000000000000', \`posLevelId\` varchar(40) NOT NULL COMMENT 'ระดับตำแหน่ง' DEFAULT '00000000-0000-0000-0000-000000000000', \`posExecutiveId\` varchar(40) NULL COMMENT 'ตำแหน่งทางการบริหาร' DEFAULT '00000000-0000-0000-0000-000000000000', \`posDictExecutiveField\` varchar(255) NULL COMMENT 'ด้านทางการบริหาร' DEFAULT 'string', \`posDictArea\` varchar(255) NULL COMMENT 'ด้าน/สาขา' DEFAULT 'string', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE \`posDict\``);
await queryRunner.query(`DROP TABLE \`position\``);
await queryRunner.query(`DROP TABLE \`posMaster\``);
}
}

View file

@ -1,48 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTablePosMaster11706685942091 implements MigrationInterface {
name = 'AddTablePosMaster11706685942091'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_cdefa5d1dc0141102324ed4bfc2\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_82aff1cb1e02d1640b5cb384420\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_3848be44d5d26ff438c893c662e\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_4bb600399098cb8596babcc9b12\` FOREIGN KEY (\`orgChild2Id\`) REFERENCES \`orgChild2\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_897d37984d8749690da88b538a4\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_1f1f5214555b0e653c40924c453\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_85c7a51d4ba358817c2187ba0c0\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD CONSTRAINT \`FK_7826c78069b4cdf5b5656460f90\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD CONSTRAINT \`FK_298491a199687ab46c830db5675\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD CONSTRAINT \`FK_4f53766362a9ee2b19969343513\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_f601e38caafa049c60b4eac6f06\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posDict\` ADD CONSTRAINT \`FK_e3827e0630023124de4e6a9063f\` FOREIGN KEY (\`posExecutiveId\`) REFERENCES \`posExecutive\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posDict\` ADD CONSTRAINT \`FK_9abc42b86d67e0f30ed64683936\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posDict\` ADD CONSTRAINT \`FK_f73c785c0db2d5178d63f3b6c46\` FOREIGN KEY (\`posLevelId\`) REFERENCES \`posLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`position\` ADD CONSTRAINT \`FK_bfcf6ec9f1e08c2a351be8df46a\` FOREIGN KEY (\`posMasterId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`position\` ADD CONSTRAINT \`FK_dc2d0309e4642e0599f27b22271\` FOREIGN KEY (\`posExecutiveId\`) REFERENCES \`posExecutive\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`position\` ADD CONSTRAINT \`FK_663dce303cab0a73190d2b55a52\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`position\` ADD CONSTRAINT \`FK_6dcc1bd887c6b4a660391ab2dc5\` 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 \`position\` DROP FOREIGN KEY \`FK_6dcc1bd887c6b4a660391ab2dc5\``);
await queryRunner.query(`ALTER TABLE \`position\` DROP FOREIGN KEY \`FK_663dce303cab0a73190d2b55a52\``);
await queryRunner.query(`ALTER TABLE \`position\` DROP FOREIGN KEY \`FK_dc2d0309e4642e0599f27b22271\``);
await queryRunner.query(`ALTER TABLE \`position\` DROP FOREIGN KEY \`FK_bfcf6ec9f1e08c2a351be8df46a\``);
await queryRunner.query(`ALTER TABLE \`posDict\` DROP FOREIGN KEY \`FK_f73c785c0db2d5178d63f3b6c46\``);
await queryRunner.query(`ALTER TABLE \`posDict\` DROP FOREIGN KEY \`FK_9abc42b86d67e0f30ed64683936\``);
await queryRunner.query(`ALTER TABLE \`posDict\` DROP FOREIGN KEY \`FK_e3827e0630023124de4e6a9063f\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_f601e38caafa049c60b4eac6f06\``);
await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP FOREIGN KEY \`FK_4f53766362a9ee2b19969343513\``);
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP FOREIGN KEY \`FK_298491a199687ab46c830db5675\``);
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP FOREIGN KEY \`FK_7826c78069b4cdf5b5656460f90\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_85c7a51d4ba358817c2187ba0c0\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_1f1f5214555b0e653c40924c453\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_897d37984d8749690da88b538a4\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_4bb600399098cb8596babcc9b12\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_3848be44d5d26ff438c893c662e\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_82aff1cb1e02d1640b5cb384420\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_cdefa5d1dc0141102324ed4bfc2\``);
}
}

View file

@ -1,38 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTablePosMaster21706696231054 implements MigrationInterface {
name = 'AddTablePosMaster21706696231054'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`orgChild2\` varchar(36) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`orgChild3OrgChild3Id\` varchar(36) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`orgChild4\` varchar(36) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgChild1Id\` \`orgChild1Id\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgChild2Id\` \`orgChild2Id\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgChild3Id\` \`orgChild3Id\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgChild4Id\` \`orgChild4Id\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_7da46fc341b77ebd43f28a8cf47\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_7e3ee4640d067c5563c060e2c6b\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_685b7779aa6d8897d5f3c899bf2\` FOREIGN KEY (\`orgChild2\`) REFERENCES \`orgChild2\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_838fef6a73e9cc70147b8f85bf7\` FOREIGN KEY (\`orgChild3OrgChild3Id\`) REFERENCES \`orgChild3\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_0564eef8bec8347d6b782a67537\` FOREIGN KEY (\`orgChild4\`) REFERENCES \`orgChild4\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_0564eef8bec8347d6b782a67537\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_838fef6a73e9cc70147b8f85bf7\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_685b7779aa6d8897d5f3c899bf2\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_7e3ee4640d067c5563c060e2c6b\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_7da46fc341b77ebd43f28a8cf47\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgChild4Id\` \`orgChild4Id\` varchar(40) NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgChild3Id\` \`orgChild3Id\` varchar(40) NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgChild2Id\` \`orgChild2Id\` varchar(40) NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgChild1Id\` \`orgChild1Id\` varchar(40) NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`orgChild4\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`orgChild3OrgChild3Id\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`orgChild2\``);
}
}

View file

@ -1,34 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTablePosMaster31706697236690 implements MigrationInterface {
name = 'AddTablePosMaster31706697236690'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_0564eef8bec8347d6b782a67537\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_685b7779aa6d8897d5f3c899bf2\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_838fef6a73e9cc70147b8f85bf7\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`orgChild2\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`orgChild3OrgChild3Id\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`orgChild4\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`posMasterNo\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`posMasterNo\` int NULL COMMENT 'เลขที่ตำแหน่ง เป็นตัวเลข'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_a0a64249023284376a480fc27ef\` FOREIGN KEY (\`orgChild2Id\`) REFERENCES \`orgChild2\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_25526f064b7ea43dd443954646b\` FOREIGN KEY (\`orgChild3Id\`) REFERENCES \`orgChild3\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_5d11d2c4513d606c8db997e5e65\` FOREIGN KEY (\`orgChild4Id\`) REFERENCES \`orgChild4\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_5d11d2c4513d606c8db997e5e65\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_25526f064b7ea43dd443954646b\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_a0a64249023284376a480fc27ef\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`posMasterNo\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`posMasterNo\` varchar(16) NULL COMMENT 'เลขที่ตำแหน่ง เป็นตัวเลข' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`orgChild4\` varchar(36) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`orgChild3OrgChild3Id\` varchar(36) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`orgChild2\` varchar(36) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_838fef6a73e9cc70147b8f85bf7\` FOREIGN KEY (\`orgChild3OrgChild3Id\`) REFERENCES \`orgChild3\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_685b7779aa6d8897d5f3c899bf2\` FOREIGN KEY (\`orgChild2\`) REFERENCES \`orgChild2\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_0564eef8bec8347d6b782a67537\` FOREIGN KEY (\`orgChild4\`) REFERENCES \`orgChild4\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}

View file

@ -1,38 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableGuidDefultNull1706758074991 implements MigrationInterface {
name = 'UpdateTableGuidDefultNull1706758074991'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`ancestorDNA\` \`isAncestorDNA\` varchar(40) NULL COMMENT 'รหัส DNA ใช้ในกรณีที่มีการทำสำเนาโครงสร้างและตำแหน่ง ตำแหน่งที่ทำสำเนามากับตำแหน่งเก่าจะต้องมี DNA เดียวกัน เพื่อให้ track ประวัติการแก้ไขตำแหน่งย้อนหลังได้' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`isAncestorDNA\` \`isAncestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`isAncestorDNA\` \`isAncestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`isAncestorDNA\` \`isAncestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`isAncestorDNA\` \`isAncestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`isAncestorDNA\` \`isAncestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`isAncestorDNA\` \`isAncestorDNA\` varchar(40) NULL COMMENT 'รหัส DNA ใช้ในกรณีที่มีการทำสำเนาโครงสร้างและตำแหน่ง ตำแหน่งที่ทำสำเนามากับตำแหน่งเก่าจะต้องมี DNA เดียวกัน เพื่อให้ track ประวัติการแก้ไขตำแหน่งย้อนหลังได้'`);
await queryRunner.query(`ALTER TABLE \`posDict\` DROP FOREIGN KEY \`FK_e3827e0630023124de4e6a9063f\``);
await queryRunner.query(`ALTER TABLE \`posDict\` CHANGE \`posExecutiveId\` \`posExecutiveId\` varchar(40) NULL COMMENT 'ตำแหน่งทางการบริหาร'`);
await queryRunner.query(`ALTER TABLE \`position\` DROP FOREIGN KEY \`FK_dc2d0309e4642e0599f27b22271\``);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`posExecutiveId\` \`posExecutiveId\` varchar(40) NULL COMMENT 'ตำแหน่งทางการบริหาร'`);
await queryRunner.query(`ALTER TABLE \`posDict\` ADD CONSTRAINT \`FK_e3827e0630023124de4e6a9063f\` FOREIGN KEY (\`posExecutiveId\`) REFERENCES \`posExecutive\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`position\` ADD CONSTRAINT \`FK_dc2d0309e4642e0599f27b22271\` FOREIGN KEY (\`posExecutiveId\`) REFERENCES \`posExecutive\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`position\` DROP FOREIGN KEY \`FK_dc2d0309e4642e0599f27b22271\``);
await queryRunner.query(`ALTER TABLE \`posDict\` DROP FOREIGN KEY \`FK_e3827e0630023124de4e6a9063f\``);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`posExecutiveId\` \`posExecutiveId\` varchar(40) NULL COMMENT 'ตำแหน่งทางการบริหาร' DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`position\` ADD CONSTRAINT \`FK_dc2d0309e4642e0599f27b22271\` FOREIGN KEY (\`posExecutiveId\`) REFERENCES \`posExecutive\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posDict\` CHANGE \`posExecutiveId\` \`posExecutiveId\` varchar(40) NULL COMMENT 'ตำแหน่งทางการบริหาร' DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`posDict\` ADD CONSTRAINT \`FK_e3827e0630023124de4e6a9063f\` FOREIGN KEY (\`posExecutiveId\`) REFERENCES \`posExecutive\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`isAncestorDNA\` \`isAncestorDNA\` varchar(40) NULL COMMENT 'รหัส DNA ใช้ในกรณีที่มีการทำสำเนาโครงสร้างและตำแหน่ง ตำแหน่งที่ทำสำเนามากับตำแหน่งเก่าจะต้องมี DNA เดียวกัน เพื่อให้ track ประวัติการแก้ไขตำแหน่งย้อนหลังได้' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`isAncestorDNA\` \`isAncestorDNA\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`isAncestorDNA\` \`isAncestorDNA\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`isAncestorDNA\` \`isAncestorDNA\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`isAncestorDNA\` \`isAncestorDNA\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`isAncestorDNA\` \`isAncestorDNA\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`isAncestorDNA\` \`ancestorDNA\` varchar(40) NULL COMMENT 'รหัส DNA ใช้ในกรณีที่มีการทำสำเนาโครงสร้างและตำแหน่ง ตำแหน่งที่ทำสำเนามากับตำแหน่งเก่าจะต้องมี DNA เดียวกัน เพื่อให้ track ประวัติการแก้ไขตำแหน่งย้อนหลังได้' DEFAULT 'string'`);
}
}

View file

@ -1,144 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableGuidDefultNull11706758236425 implements MigrationInterface {
name = 'UpdateTableGuidDefultNull11706758236425'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_82aff1cb1e02d1640b5cb384420\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_3848be44d5d26ff438c893c662e\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_4bb600399098cb8596babcc9b12\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_36291e45193793ac8730d5b9ff4\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_cdefa5d1dc0141102324ed4bfc2\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild1Id\` \`orgChild1Id\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild2Id\` \`orgChild2Id\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild3Id\` \`orgChild3Id\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_1f1f5214555b0e653c40924c453\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_85c7a51d4ba358817c2187ba0c0\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_abe35eefd8fb2bf682542c57b5e\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_897d37984d8749690da88b538a4\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgChild1Id\` \`orgChild1Id\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgChild2Id\` \`orgChild2Id\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP FOREIGN KEY \`FK_298491a199687ab46c830db5675\``);
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP FOREIGN KEY \`FK_b3e512809e7e8dea0a6a1c0d95f\``);
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP FOREIGN KEY \`FK_7826c78069b4cdf5b5656460f90\``);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgChild1Id\` \`orgChild1Id\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP FOREIGN KEY \`FK_9481ca31027bf02594ed533b765\``);
await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP FOREIGN KEY \`FK_4f53766362a9ee2b19969343513\``);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP FOREIGN KEY \`FK_b9d787230c285dcd0ba4c63d33b\``);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_f601e38caafa049c60b4eac6f06\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`posDict\` DROP FOREIGN KEY \`FK_9abc42b86d67e0f30ed64683936\``);
await queryRunner.query(`ALTER TABLE \`posDict\` DROP FOREIGN KEY \`FK_f73c785c0db2d5178d63f3b6c46\``);
await queryRunner.query(`ALTER TABLE \`posDict\` CHANGE \`posTypeId\` \`posTypeId\` varchar(40) NOT NULL COMMENT 'ตำแหน่งประเภท'`);
await queryRunner.query(`ALTER TABLE \`posDict\` CHANGE \`posLevelId\` \`posLevelId\` varchar(40) NOT NULL COMMENT 'ระดับตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`position\` DROP FOREIGN KEY \`FK_663dce303cab0a73190d2b55a52\``);
await queryRunner.query(`ALTER TABLE \`position\` DROP FOREIGN KEY \`FK_6dcc1bd887c6b4a660391ab2dc5\``);
await queryRunner.query(`ALTER TABLE \`position\` DROP FOREIGN KEY \`FK_bfcf6ec9f1e08c2a351be8df46a\``);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`posTypeId\` \`posTypeId\` varchar(40) NOT NULL COMMENT 'ประเภทตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`posLevelId\` \`posLevelId\` varchar(40) NOT NULL COMMENT 'ระดับตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`posMasterId\` \`posMasterId\` varchar(40) NOT NULL COMMENT 'เชื่อมโยงกับตารางเลขที่ตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`posLevel\` DROP FOREIGN KEY \`FK_66caa3d974b67a8a8b343d029b2\``);
await queryRunner.query(`ALTER TABLE \`posLevel\` CHANGE \`posTypeId\` \`posTypeId\` varchar(40) NOT NULL COMMENT 'เป็นระดับของประเภทตำแหน่งใด'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_cdefa5d1dc0141102324ed4bfc2\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_82aff1cb1e02d1640b5cb384420\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_3848be44d5d26ff438c893c662e\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_4bb600399098cb8596babcc9b12\` FOREIGN KEY (\`orgChild2Id\`) REFERENCES \`orgChild2\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_36291e45193793ac8730d5b9ff4\` FOREIGN KEY (\`orgChild3Id\`) REFERENCES \`orgChild3\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_897d37984d8749690da88b538a4\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_1f1f5214555b0e653c40924c453\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_85c7a51d4ba358817c2187ba0c0\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_abe35eefd8fb2bf682542c57b5e\` FOREIGN KEY (\`orgChild2Id\`) REFERENCES \`orgChild2\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD CONSTRAINT \`FK_7826c78069b4cdf5b5656460f90\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD CONSTRAINT \`FK_298491a199687ab46c830db5675\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD CONSTRAINT \`FK_b3e512809e7e8dea0a6a1c0d95f\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD CONSTRAINT \`FK_4f53766362a9ee2b19969343513\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD CONSTRAINT \`FK_9481ca31027bf02594ed533b765\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD CONSTRAINT \`FK_b9d787230c285dcd0ba4c63d33b\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_f601e38caafa049c60b4eac6f06\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posDict\` ADD CONSTRAINT \`FK_9abc42b86d67e0f30ed64683936\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posDict\` ADD CONSTRAINT \`FK_f73c785c0db2d5178d63f3b6c46\` FOREIGN KEY (\`posLevelId\`) REFERENCES \`posLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`position\` ADD CONSTRAINT \`FK_bfcf6ec9f1e08c2a351be8df46a\` FOREIGN KEY (\`posMasterId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`position\` ADD CONSTRAINT \`FK_663dce303cab0a73190d2b55a52\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`position\` ADD CONSTRAINT \`FK_6dcc1bd887c6b4a660391ab2dc5\` FOREIGN KEY (\`posLevelId\`) REFERENCES \`posLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posLevel\` ADD CONSTRAINT \`FK_66caa3d974b67a8a8b343d029b2\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posLevel\` DROP FOREIGN KEY \`FK_66caa3d974b67a8a8b343d029b2\``);
await queryRunner.query(`ALTER TABLE \`position\` DROP FOREIGN KEY \`FK_6dcc1bd887c6b4a660391ab2dc5\``);
await queryRunner.query(`ALTER TABLE \`position\` DROP FOREIGN KEY \`FK_663dce303cab0a73190d2b55a52\``);
await queryRunner.query(`ALTER TABLE \`position\` DROP FOREIGN KEY \`FK_bfcf6ec9f1e08c2a351be8df46a\``);
await queryRunner.query(`ALTER TABLE \`posDict\` DROP FOREIGN KEY \`FK_f73c785c0db2d5178d63f3b6c46\``);
await queryRunner.query(`ALTER TABLE \`posDict\` DROP FOREIGN KEY \`FK_9abc42b86d67e0f30ed64683936\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_f601e38caafa049c60b4eac6f06\``);
await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP FOREIGN KEY \`FK_b9d787230c285dcd0ba4c63d33b\``);
await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP FOREIGN KEY \`FK_9481ca31027bf02594ed533b765\``);
await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP FOREIGN KEY \`FK_4f53766362a9ee2b19969343513\``);
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP FOREIGN KEY \`FK_b3e512809e7e8dea0a6a1c0d95f\``);
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP FOREIGN KEY \`FK_298491a199687ab46c830db5675\``);
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP FOREIGN KEY \`FK_7826c78069b4cdf5b5656460f90\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_abe35eefd8fb2bf682542c57b5e\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_85c7a51d4ba358817c2187ba0c0\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_1f1f5214555b0e653c40924c453\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_897d37984d8749690da88b538a4\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_36291e45193793ac8730d5b9ff4\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_4bb600399098cb8596babcc9b12\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_3848be44d5d26ff438c893c662e\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_82aff1cb1e02d1640b5cb384420\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_cdefa5d1dc0141102324ed4bfc2\``);
await queryRunner.query(`ALTER TABLE \`posLevel\` CHANGE \`posTypeId\` \`posTypeId\` varchar(40) NOT NULL COMMENT 'เป็นระดับของประเภทตำแหน่งใด' DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`posLevel\` ADD CONSTRAINT \`FK_66caa3d974b67a8a8b343d029b2\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`posMasterId\` \`posMasterId\` varchar(40) NOT NULL COMMENT 'เชื่อมโยงกับตารางเลขที่ตำแหน่ง' DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`posLevelId\` \`posLevelId\` varchar(40) NOT NULL COMMENT 'ระดับตำแหน่ง' DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`posTypeId\` \`posTypeId\` varchar(40) NOT NULL COMMENT 'ประเภทตำแหน่ง' DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`position\` ADD CONSTRAINT \`FK_bfcf6ec9f1e08c2a351be8df46a\` FOREIGN KEY (\`posMasterId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`position\` ADD CONSTRAINT \`FK_6dcc1bd887c6b4a660391ab2dc5\` FOREIGN KEY (\`posLevelId\`) REFERENCES \`posLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`position\` ADD CONSTRAINT \`FK_663dce303cab0a73190d2b55a52\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posDict\` CHANGE \`posLevelId\` \`posLevelId\` varchar(40) NOT NULL COMMENT 'ระดับตำแหน่ง' DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`posDict\` CHANGE \`posTypeId\` \`posTypeId\` varchar(40) NOT NULL COMMENT 'ตำแหน่งประเภท' DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`posDict\` ADD CONSTRAINT \`FK_f73c785c0db2d5178d63f3b6c46\` FOREIGN KEY (\`posLevelId\`) REFERENCES \`posLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posDict\` ADD CONSTRAINT \`FK_9abc42b86d67e0f30ed64683936\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_f601e38caafa049c60b4eac6f06\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD CONSTRAINT \`FK_b9d787230c285dcd0ba4c63d33b\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD CONSTRAINT \`FK_4f53766362a9ee2b19969343513\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD CONSTRAINT \`FK_9481ca31027bf02594ed533b765\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgChild1Id\` \`orgChild1Id\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD CONSTRAINT \`FK_7826c78069b4cdf5b5656460f90\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD CONSTRAINT \`FK_b3e512809e7e8dea0a6a1c0d95f\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD CONSTRAINT \`FK_298491a199687ab46c830db5675\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgChild2Id\` \`orgChild2Id\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgChild1Id\` \`orgChild1Id\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_897d37984d8749690da88b538a4\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_abe35eefd8fb2bf682542c57b5e\` FOREIGN KEY (\`orgChild2Id\`) REFERENCES \`orgChild2\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_85c7a51d4ba358817c2187ba0c0\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_1f1f5214555b0e653c40924c453\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild3Id\` \`orgChild3Id\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild2Id\` \`orgChild2Id\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild1Id\` \`orgChild1Id\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_cdefa5d1dc0141102324ed4bfc2\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_36291e45193793ac8730d5b9ff4\` FOREIGN KEY (\`orgChild3Id\`) REFERENCES \`orgChild3\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_4bb600399098cb8596babcc9b12\` FOREIGN KEY (\`orgChild2Id\`) REFERENCES \`orgChild2\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_3848be44d5d26ff438c893c662e\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_82aff1cb1e02d1640b5cb384420\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}

View file

@ -1,82 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableGuidDefultNull21706760094173 implements MigrationInterface {
name = 'UpdateTableGuidDefultNull21706760094173'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild4Name\` \`orgChild4Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild4ShortName\` \`orgChild4ShortName\` varchar(16) NULL COMMENT 'ชื่อย่อส่วนราชการ'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild4Code\` \`orgChild4Code\` varchar(8) NULL COMMENT 'รหัสส่วนราชการ'`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgChild3Name\` \`orgChild3Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ'`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgChild3ShortName\` \`orgChild3ShortName\` varchar(16) NULL COMMENT 'ชื่อย่อส่วนราชการ'`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgChild3Code\` \`orgChild3Code\` varchar(8) NULL COMMENT 'รหัสส่วนราชการ'`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgChild2Name\` \`orgChild2Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ'`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgChild2ShortName\` \`orgChild2ShortName\` varchar(16) NULL COMMENT 'ชื่อย่อส่วนราชการ'`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgChild2Code\` \`orgChild2Code\` varchar(8) NULL COMMENT 'รหัสส่วนราชการ'`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`orgChild1Name\` \`orgChild1Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ'`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`orgChild1ShortName\` \`orgChild1ShortName\` varchar(16) NULL COMMENT 'ชื่อย่อส่วนราชการ'`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`orgChild1Code\` \`orgChild1Code\` varchar(8) NULL COMMENT 'รหัสส่วนราชการ'`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`orgRootName\` \`orgRootName\` varchar(255) NULL COMMENT 'ชื่อหน่วยงาน'`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`orgRootShortName\` \`orgRootShortName\` varchar(16) NULL COMMENT 'ชื่อย่อหน่วยงาน'`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`orgRootCode\` \`orgRootCode\` varchar(8) NULL COMMENT 'รหัสหน่วยงาน'`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`orgRootRank\` \`orgRootRank\` enum ('DEPARTMENT', 'OFFICE', 'DIVISION', 'SECTION') NULL COMMENT 'ระดับของหน่วยงาน'`);
await queryRunner.query(`ALTER TABLE \`orgRevision\` CHANGE \`orgRevisionName\` \`orgRevisionName\` varchar(255) NULL`);
await queryRunner.query(`ALTER TABLE \`orgRevision\` CHANGE \`orgRevisionIsCurrent\` \`orgRevisionIsCurrent\` tinyint NOT NULL DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`orgRevision\` CHANGE \`orgRevisionIsDraft\` \`orgRevisionIsDraft\` tinyint NOT NULL DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`posMasterNoPrefix\` \`posMasterNoPrefix\` varchar(16) NULL COMMENT 'Prefix นำหน้าเลขที่ตำแหน่ง เป็น Optional (ไม่ใช่อักษรย่อของหน่วยงาน/ส่วนราชการ)'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`posMasterNoSuffix\` \`posMasterNoSuffix\` varchar(16) NULL COMMENT 'Suffix หลังเลขที่ตำแหน่ง เช่น ช.'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`profileIdCurrentHolder\` \`profileIdCurrentHolder\` varchar(40) NULL COMMENT 'คนครองปัจจุบัน เมื่อทำสำเนาโครงสร้างและตำแหน่งพร้อมกับคนครองมา คนครองจะอยู่ในฟิลด์นี้'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`profileIdNextHolder\` \`profileIdNextHolder\` varchar(40) NULL COMMENT 'คนที่กำลังจะมาครอง ตอนปรับโครงสร้าง ถ้าเลือกให้ใครมาครอง ProfileId ของคนนั้นจะมาอยู่ในช่องนี้ รวมทั้งตอนเลือกตำแหน่งเพื่อบรรจุ แต่งตั้ง เลื่อน ย้าย ในระบบบรรจุแต่งตั้งด้วย'`);
await queryRunner.query(`ALTER TABLE \`posDict\` CHANGE \`posDictName\` \`posDictName\` varchar(255) NULL COMMENT 'ชื่อตำแหน่งในสายงาน (ชื่อตำแหน่ง)'`);
await queryRunner.query(`ALTER TABLE \`posDict\` CHANGE \`posDictField\` \`posDictField\` varchar(255) NULL COMMENT 'สายงาน'`);
await queryRunner.query(`ALTER TABLE \`posDict\` CHANGE \`posDictExecutiveField\` \`posDictExecutiveField\` varchar(255) NULL COMMENT 'ด้านทางการบริหาร'`);
await queryRunner.query(`ALTER TABLE \`posDict\` CHANGE \`posDictArea\` \`posDictArea\` varchar(255) NULL COMMENT 'ด้าน/สาขา'`);
await queryRunner.query(`ALTER TABLE \`posExecutive\` CHANGE \`posExecutiveName\` \`posExecutiveName\` varchar(255) NULL COMMENT 'ชื่อตำแหน่งทางการบริหาร'`);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`positionName\` \`positionName\` varchar(255) NULL COMMENT 'ชื่อตำแหน่งในสายงาน (ชื่อตำแหน่ง)'`);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`positionField\` \`positionField\` varchar(45) NULL COMMENT 'สายงาน'`);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`positionExecutiveField\` \`positionExecutiveField\` varchar(255) NULL COMMENT 'ด้านทางการบริหาร'`);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`positionArea\` \`positionArea\` varchar(255) NULL COMMENT 'ด้าน/สาขา'`);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`positionIsSelected\` \`positionIsSelected\` tinyint NOT NULL COMMENT 'เป็นตำแหน่งที่ถูกเลือกในรอบนั้นๆ หรือไม่?' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`posType\` CHANGE \`posTypeName\` \`posTypeName\` varchar(255) NULL COMMENT 'ชื่อประเภทตำแหน่ง (ทั่วไป วิชาการ อำนวยการ บริหาร)'`);
await queryRunner.query(`ALTER TABLE \`posLevel\` CHANGE \`posLevelName\` \`posLevelName\` varchar(255) NULL COMMENT 'ชื่อระดับตำแหน่ง'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posLevel\` CHANGE \`posLevelName\` \`posLevelName\` varchar(255) NULL COMMENT 'ชื่อระดับตำแหน่ง' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`posType\` CHANGE \`posTypeName\` \`posTypeName\` varchar(255) NULL COMMENT 'ชื่อประเภทตำแหน่ง (ทั่วไป วิชาการ อำนวยการ บริหาร)' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`positionIsSelected\` \`positionIsSelected\` tinyint NULL COMMENT 'เป็นตำแหน่งที่ถูกเลือกในรอบนั้นๆ หรือไม่?'`);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`positionArea\` \`positionArea\` varchar(255) NULL COMMENT 'ด้าน/สาขา' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`positionExecutiveField\` \`positionExecutiveField\` varchar(255) NULL COMMENT 'ด้านทางการบริหาร' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`positionField\` \`positionField\` varchar(45) NULL COMMENT 'สายงาน' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`positionName\` \`positionName\` varchar(255) NULL COMMENT 'ชื่อตำแหน่งในสายงาน (ชื่อตำแหน่ง)' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`posExecutive\` CHANGE \`posExecutiveName\` \`posExecutiveName\` varchar(255) NULL COMMENT 'ชื่อตำแหน่งทางการบริหาร' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`posDict\` CHANGE \`posDictArea\` \`posDictArea\` varchar(255) NULL COMMENT 'ด้าน/สาขา' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`posDict\` CHANGE \`posDictExecutiveField\` \`posDictExecutiveField\` varchar(255) NULL COMMENT 'ด้านทางการบริหาร' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`posDict\` CHANGE \`posDictField\` \`posDictField\` varchar(255) NULL COMMENT 'สายงาน' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`posDict\` CHANGE \`posDictName\` \`posDictName\` varchar(255) NULL COMMENT 'ชื่อตำแหน่งในสายงาน (ชื่อตำแหน่ง)' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`profileIdNextHolder\` \`profileIdNextHolder\` varchar(40) NULL COMMENT 'คนที่กำลังจะมาครอง ตอนปรับโครงสร้าง ถ้าเลือกให้ใครมาครอง ProfileId ของคนนั้นจะมาอยู่ในช่องนี้ รวมทั้งตอนเลือกตำแหน่งเพื่อบรรจุ แต่งตั้ง เลื่อน ย้าย ในระบบบรรจุแต่งตั้งด้วย' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`profileIdCurrentHolder\` \`profileIdCurrentHolder\` varchar(40) NULL COMMENT 'คนครองปัจจุบัน เมื่อทำสำเนาโครงสร้างและตำแหน่งพร้อมกับคนครองมา คนครองจะอยู่ในฟิลด์นี้' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`posMasterNoSuffix\` \`posMasterNoSuffix\` varchar(16) NULL COMMENT 'Suffix หลังเลขที่ตำแหน่ง เช่น ช.' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`posMasterNoPrefix\` \`posMasterNoPrefix\` varchar(16) NULL COMMENT 'Prefix นำหน้าเลขที่ตำแหน่ง เป็น Optional (ไม่ใช่อักษรย่อของหน่วยงาน/ส่วนราชการ)' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgRevision\` CHANGE \`orgRevisionIsDraft\` \`orgRevisionIsDraft\` tinyint NULL DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`orgRevision\` CHANGE \`orgRevisionIsCurrent\` \`orgRevisionIsCurrent\` tinyint NULL DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`orgRevision\` CHANGE \`orgRevisionName\` \`orgRevisionName\` varchar(255) NOT NULL DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`orgRootRank\` \`orgRootRank\` enum ('DEPARTMENT', 'OFFICE', 'DIVISION', 'SECTION') NULL COMMENT 'ระดับของหน่วยงาน' DEFAULT 'DEPARTMENT'`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`orgRootCode\` \`orgRootCode\` varchar(8) NULL COMMENT 'รหัสหน่วยงาน' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`orgRootShortName\` \`orgRootShortName\` varchar(16) NULL COMMENT 'ชื่อย่อหน่วยงาน' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`orgRootName\` \`orgRootName\` varchar(255) NULL COMMENT 'ชื่อหน่วยงาน' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`orgChild1Code\` \`orgChild1Code\` varchar(8) NULL COMMENT 'รหัสส่วนราชการ' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`orgChild1ShortName\` \`orgChild1ShortName\` varchar(16) NULL COMMENT 'ชื่อย่อส่วนราชการ' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`orgChild1Name\` \`orgChild1Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgChild2Code\` \`orgChild2Code\` varchar(8) NULL COMMENT 'รหัสส่วนราชการ' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgChild2ShortName\` \`orgChild2ShortName\` varchar(16) NULL COMMENT 'ชื่อย่อส่วนราชการ' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgChild2Name\` \`orgChild2Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgChild3Code\` \`orgChild3Code\` varchar(8) NULL COMMENT 'รหัสส่วนราชการ' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgChild3ShortName\` \`orgChild3ShortName\` varchar(16) NULL COMMENT 'ชื่อย่อส่วนราชการ' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgChild3Name\` \`orgChild3Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild4Code\` \`orgChild4Code\` varchar(8) NULL COMMENT 'รหัสส่วนราชการ' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild4ShortName\` \`orgChild4ShortName\` varchar(16) NULL COMMENT 'ชื่อย่อส่วนราชการ' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild4Name\` \`orgChild4Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ' DEFAULT 'string'`);
}
}

View file

@ -1,24 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableAncestorDNA1706768882759 implements MigrationInterface {
name = 'UpdateTableAncestorDNA1706768882759'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`isAncestorDNA\` \`ancestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`isAncestorDNA\` \`ancestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`isAncestorDNA\` \`ancestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`isAncestorDNA\` \`ancestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`isAncestorDNA\` \`ancestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`isAncestorDNA\` \`ancestorDNA\` varchar(40) NULL COMMENT 'รหัส DNA ใช้ในกรณีที่มีการทำสำเนาโครงสร้างและตำแหน่ง ตำแหน่งที่ทำสำเนามากับตำแหน่งเก่าจะต้องมี DNA เดียวกัน เพื่อให้ track ประวัติการแก้ไขตำแหน่งย้อนหลังได้'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`ancestorDNA\` \`isAncestorDNA\` varchar(40) NULL COMMENT 'รหัส DNA ใช้ในกรณีที่มีการทำสำเนาโครงสร้างและตำแหน่ง ตำแหน่งที่ทำสำเนามากับตำแหน่งเก่าจะต้องมี DNA เดียวกัน เพื่อให้ track ประวัติการแก้ไขตำแหน่งย้อนหลังได้'`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`ancestorDNA\` \`isAncestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`ancestorDNA\` \`isAncestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`ancestorDNA\` \`isAncestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`ancestorDNA\` \`isAncestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`ancestorDNA\` \`isAncestorDNA\` varchar(40) NULL`);
}
}

View file

@ -1,170 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class Create7table1706845176364 implements MigrationInterface {
name = 'Create7table1706845176364'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`relationship\` (\`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', \`name\` varchar(255) NULL COMMENT 'สถานภาพ', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`rank\` (\`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', \`name\` varchar(255) NULL COMMENT 'ยศ', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`religion\` (\`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', \`name\` varchar(255) NULL COMMENT 'ศาสนา', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`prefixe\` (\`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', \`name\` varchar(255) NULL COMMENT 'คำนำหน้าชื่อ', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`gender\` (\`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', \`name\` varchar(255) NULL COMMENT 'เพศ', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`educationLevel\` (\`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', \`name\` varchar(255) NULL COMMENT 'ระดับการศึกษา', \`rank\` int NULL COMMENT 'ระดับที่', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`bloodGroup\` (\`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', \`name\` varchar(255) NULL COMMENT 'กรุ๊ปเลือด', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_82aff1cb1e02d1640b5cb384420\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_3848be44d5d26ff438c893c662e\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_4bb600399098cb8596babcc9b12\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_36291e45193793ac8730d5b9ff4\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_cdefa5d1dc0141102324ed4bfc2\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgRoot'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild1Id\` \`orgChild1Id\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild1'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild2Id\` \`orgChild2Id\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild2'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild3Id\` \`orgChild3Id\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild3'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgRevision'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`ancestorDNA\` \`ancestorDNA\` varchar(40) NULL COMMENT 'รหัส DNA ใช้ในกรณีที่มีการทำสำเนาโครงสร้าง โครงสร้างใหม่ที่ทำสำเนากับโครงสร้างเก่าจะต้องมี DNA เดียวกัน เพื่อให้ track ประวัติการแก้ไขโครงสร้างย้อนหลังได้'`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_1f1f5214555b0e653c40924c453\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_85c7a51d4ba358817c2187ba0c0\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_abe35eefd8fb2bf682542c57b5e\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_897d37984d8749690da88b538a4\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgRoot'`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgChild1Id\` \`orgChild1Id\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild1'`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgChild2Id\` \`orgChild2Id\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild2'`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgRevision'`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`ancestorDNA\` \`ancestorDNA\` varchar(40) NULL COMMENT 'รหัส DNA ใช้ในกรณีที่มีการทำสำเนาโครงสร้าง โครงสร้างใหม่ที่ทำสำเนากับโครงสร้างเก่าจะต้องมี DNA เดียวกัน เพื่อให้ track ประวัติการแก้ไขโครงสร้างย้อนหลังได้'`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP FOREIGN KEY \`FK_298491a199687ab46c830db5675\``);
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP FOREIGN KEY \`FK_b3e512809e7e8dea0a6a1c0d95f\``);
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP FOREIGN KEY \`FK_7826c78069b4cdf5b5656460f90\``);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgRoot'`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgChild1Id\` \`orgChild1Id\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild1'`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgRevision'`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`ancestorDNA\` \`ancestorDNA\` varchar(40) NULL COMMENT 'รหัส DNA ใช้ในกรณีที่มีการทำสำเนาโครงสร้าง โครงสร้างใหม่ที่ทำสำเนากับโครงสร้างเก่าจะต้องมี DNA เดียวกัน เพื่อให้ track ประวัติการแก้ไขโครงสร้างย้อนหลังได้'`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP FOREIGN KEY \`FK_9481ca31027bf02594ed533b765\``);
await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP FOREIGN KEY \`FK_4f53766362a9ee2b19969343513\``);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgRoot'`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgRevision'`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`ancestorDNA\` \`ancestorDNA\` varchar(40) NULL COMMENT 'รหัส DNA ใช้ในกรณีที่มีการทำสำเนาโครงสร้าง โครงสร้างใหม่ที่ทำสำเนากับโครงสร้างเก่าจะต้องมี DNA เดียวกัน เพื่อให้ track ประวัติการแก้ไขโครงสร้างย้อนหลังได้'`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP FOREIGN KEY \`FK_b9d787230c285dcd0ba4c63d33b\``);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`ancestorDNA\` \`ancestorDNA\` varchar(40) NULL COMMENT 'รหัส DNA ใช้ในกรณีที่มีการทำสำเนาโครงสร้าง โครงสร้างใหม่ที่ทำสำเนากับโครงสร้างเก่าจะต้องมี DNA เดียวกัน เพื่อให้ track ประวัติการแก้ไขโครงสร้างย้อนหลังได้'`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgRevision'`);
await queryRunner.query(`ALTER TABLE \`orgRevision\` CHANGE \`orgRevisionName\` \`orgRevisionName\` varchar(255) NULL COMMENT 'ชื่อของโครงสร้าง'`);
await queryRunner.query(`ALTER TABLE \`orgRevision\` CHANGE \`orgRevisionIsCurrent\` \`orgRevisionIsCurrent\` tinyint NOT NULL COMMENT 'สถานะเป็นโครงสร้างปัจจุบันหรือไม่' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`orgRevision\` CHANGE \`orgRevisionCreatedAt\` \`orgRevisionCreatedAt\` datetime NULL COMMENT 'วันเวลาที่สร้างโครงสร้าง'`);
await queryRunner.query(`ALTER TABLE \`orgRevision\` CHANGE \`orgRevisionIsDraft\` \`orgRevisionIsDraft\` tinyint NOT NULL COMMENT 'สถานะเป็นโครงสร้างแบบร่างหรือไม่' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_7da46fc341b77ebd43f28a8cf47\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_7e3ee4640d067c5563c060e2c6b\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_a0a64249023284376a480fc27ef\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_25526f064b7ea43dd443954646b\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_5d11d2c4513d606c8db997e5e65\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_f601e38caafa049c60b4eac6f06\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgRoot'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgChild1Id\` \`orgChild1Id\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild1'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgChild2Id\` \`orgChild2Id\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild2'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgChild3Id\` \`orgChild3Id\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild3'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgChild4Id\` \`orgChild4Id\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild4'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgRevision'`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_cdefa5d1dc0141102324ed4bfc2\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_82aff1cb1e02d1640b5cb384420\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_3848be44d5d26ff438c893c662e\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_4bb600399098cb8596babcc9b12\` FOREIGN KEY (\`orgChild2Id\`) REFERENCES \`orgChild2\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_36291e45193793ac8730d5b9ff4\` FOREIGN KEY (\`orgChild3Id\`) REFERENCES \`orgChild3\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_897d37984d8749690da88b538a4\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_1f1f5214555b0e653c40924c453\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_85c7a51d4ba358817c2187ba0c0\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_abe35eefd8fb2bf682542c57b5e\` FOREIGN KEY (\`orgChild2Id\`) REFERENCES \`orgChild2\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD CONSTRAINT \`FK_7826c78069b4cdf5b5656460f90\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD CONSTRAINT \`FK_298491a199687ab46c830db5675\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD CONSTRAINT \`FK_b3e512809e7e8dea0a6a1c0d95f\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD CONSTRAINT \`FK_4f53766362a9ee2b19969343513\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD CONSTRAINT \`FK_9481ca31027bf02594ed533b765\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD CONSTRAINT \`FK_b9d787230c285dcd0ba4c63d33b\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_f601e38caafa049c60b4eac6f06\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_7da46fc341b77ebd43f28a8cf47\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_7e3ee4640d067c5563c060e2c6b\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_a0a64249023284376a480fc27ef\` FOREIGN KEY (\`orgChild2Id\`) REFERENCES \`orgChild2\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_25526f064b7ea43dd443954646b\` FOREIGN KEY (\`orgChild3Id\`) REFERENCES \`orgChild3\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_5d11d2c4513d606c8db997e5e65\` FOREIGN KEY (\`orgChild4Id\`) REFERENCES \`orgChild4\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_5d11d2c4513d606c8db997e5e65\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_25526f064b7ea43dd443954646b\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_a0a64249023284376a480fc27ef\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_7e3ee4640d067c5563c060e2c6b\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_7da46fc341b77ebd43f28a8cf47\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_f601e38caafa049c60b4eac6f06\``);
await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP FOREIGN KEY \`FK_b9d787230c285dcd0ba4c63d33b\``);
await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP FOREIGN KEY \`FK_9481ca31027bf02594ed533b765\``);
await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP FOREIGN KEY \`FK_4f53766362a9ee2b19969343513\``);
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP FOREIGN KEY \`FK_b3e512809e7e8dea0a6a1c0d95f\``);
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP FOREIGN KEY \`FK_298491a199687ab46c830db5675\``);
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP FOREIGN KEY \`FK_7826c78069b4cdf5b5656460f90\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_abe35eefd8fb2bf682542c57b5e\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_85c7a51d4ba358817c2187ba0c0\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_1f1f5214555b0e653c40924c453\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP FOREIGN KEY \`FK_897d37984d8749690da88b538a4\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_36291e45193793ac8730d5b9ff4\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_4bb600399098cb8596babcc9b12\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_3848be44d5d26ff438c893c662e\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_82aff1cb1e02d1640b5cb384420\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP FOREIGN KEY \`FK_cdefa5d1dc0141102324ed4bfc2\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgChild4Id\` \`orgChild4Id\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgChild3Id\` \`orgChild3Id\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgChild2Id\` \`orgChild2Id\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgChild1Id\` \`orgChild1Id\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_f601e38caafa049c60b4eac6f06\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_5d11d2c4513d606c8db997e5e65\` FOREIGN KEY (\`orgChild4Id\`) REFERENCES \`orgChild4\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_25526f064b7ea43dd443954646b\` FOREIGN KEY (\`orgChild3Id\`) REFERENCES \`orgChild3\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_a0a64249023284376a480fc27ef\` FOREIGN KEY (\`orgChild2Id\`) REFERENCES \`orgChild2\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_7e3ee4640d067c5563c060e2c6b\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_7da46fc341b77ebd43f28a8cf47\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgRevision\` CHANGE \`orgRevisionIsDraft\` \`orgRevisionIsDraft\` tinyint NOT NULL DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`orgRevision\` CHANGE \`orgRevisionCreatedAt\` \`orgRevisionCreatedAt\` datetime NULL`);
await queryRunner.query(`ALTER TABLE \`orgRevision\` CHANGE \`orgRevisionIsCurrent\` \`orgRevisionIsCurrent\` tinyint NOT NULL DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`orgRevision\` CHANGE \`orgRevisionName\` \`orgRevisionName\` varchar(255) NULL`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`ancestorDNA\` \`ancestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD CONSTRAINT \`FK_b9d787230c285dcd0ba4c63d33b\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`ancestorDNA\` \`ancestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD CONSTRAINT \`FK_4f53766362a9ee2b19969343513\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD CONSTRAINT \`FK_9481ca31027bf02594ed533b765\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`ancestorDNA\` \`ancestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgChild1Id\` \`orgChild1Id\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD CONSTRAINT \`FK_7826c78069b4cdf5b5656460f90\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD CONSTRAINT \`FK_b3e512809e7e8dea0a6a1c0d95f\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD CONSTRAINT \`FK_298491a199687ab46c830db5675\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`ancestorDNA\` \`ancestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgChild2Id\` \`orgChild2Id\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgChild1Id\` \`orgChild1Id\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_897d37984d8749690da88b538a4\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_abe35eefd8fb2bf682542c57b5e\` FOREIGN KEY (\`orgChild2Id\`) REFERENCES \`orgChild2\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_85c7a51d4ba358817c2187ba0c0\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD CONSTRAINT \`FK_1f1f5214555b0e653c40924c453\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`ancestorDNA\` \`ancestorDNA\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgRevisionId\` \`orgRevisionId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild3Id\` \`orgChild3Id\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild2Id\` \`orgChild2Id\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgChild1Id\` \`orgChild1Id\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`orgRootId\` \`orgRootId\` varchar(40) NOT NULL`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_cdefa5d1dc0141102324ed4bfc2\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_36291e45193793ac8730d5b9ff4\` FOREIGN KEY (\`orgChild3Id\`) REFERENCES \`orgChild3\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_4bb600399098cb8596babcc9b12\` FOREIGN KEY (\`orgChild2Id\`) REFERENCES \`orgChild2\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_3848be44d5d26ff438c893c662e\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD CONSTRAINT \`FK_82aff1cb1e02d1640b5cb384420\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`DROP TABLE \`bloodGroup\``);
await queryRunner.query(`DROP TABLE \`educationLevel\``);
await queryRunner.query(`DROP TABLE \`gender\``);
await queryRunner.query(`DROP TABLE \`prefixe\``);
await queryRunner.query(`DROP TABLE \`religion\``);
await queryRunner.query(`DROP TABLE \`rank\``);
await queryRunner.query(`DROP TABLE \`relationship\``);
}
}

View file

@ -1,18 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableProfile1707189271932 implements MigrationInterface {
name = 'AddTableProfile1707189271932'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`profile\` (\`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', \`prefix\` varchar(40) NULL COMMENT 'คำนำหน้าชื่อ', \`firstName\` varchar(255) NULL COMMENT 'ชื่อ', \`lastName\` varchar(255) NULL COMMENT 'นามสกุล', \`citizenId\` int NULL COMMENT 'เลขประจำตัวประชาชน', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_1acc4ba5b4af308f0d8a1b7b249\` FOREIGN KEY (\`profileIdCurrentHolder\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_9d29f52dcf499db3a5e8209b6dc\` FOREIGN KEY (\`profileIdNextHolder\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_9d29f52dcf499db3a5e8209b6dc\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_1acc4ba5b4af308f0d8a1b7b249\``);
await queryRunner.query(`DROP TABLE \`profile\``);
}
}

View file

@ -1,52 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableProfile11707194386583 implements MigrationInterface {
name = 'AddTableProfile11707194386583'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_1acc4ba5b4af308f0d8a1b7b249\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_9d29f52dcf499db3a5e8209b6dc\``);
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`currentHolderId\` varchar(36) NULL`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD UNIQUE INDEX \`IDX_b5bfc34771c02a8078b9bf8944\` (\`currentHolderId\`)`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`nextHolderId\` varchar(36) NULL`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD UNIQUE INDEX \`IDX_49d2dcf6c8bd789ca99df7dc0d\` (\`nextHolderId\`)`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`currentHolderId\` varchar(36) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD UNIQUE INDEX \`IDX_dca00872043f09a74af1d5172f\` (\`currentHolderId\`)`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`nextHolderId\` varchar(36) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD UNIQUE INDEX \`IDX_d15696d0e541ead772db817b36\` (\`nextHolderId\`)`);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`citizenId\``);
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`citizenId\` varchar(13) NULL COMMENT 'เลขประจำตัวประชาชน'`);
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_b5bfc34771c02a8078b9bf8944\` ON \`profile\` (\`currentHolderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_49d2dcf6c8bd789ca99df7dc0d\` ON \`profile\` (\`nextHolderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_dca00872043f09a74af1d5172f\` ON \`posMaster\` (\`currentHolderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_d15696d0e541ead772db817b36\` ON \`posMaster\` (\`nextHolderId\`)`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_b5bfc34771c02a8078b9bf89445\` FOREIGN KEY (\`currentHolderId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_49d2dcf6c8bd789ca99df7dc0d4\` FOREIGN KEY (\`nextHolderId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_dca00872043f09a74af1d5172f3\` FOREIGN KEY (\`currentHolderId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_d15696d0e541ead772db817b36a\` FOREIGN KEY (\`nextHolderId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_d15696d0e541ead772db817b36a\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_dca00872043f09a74af1d5172f3\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_49d2dcf6c8bd789ca99df7dc0d4\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_b5bfc34771c02a8078b9bf89445\``);
await queryRunner.query(`DROP INDEX \`REL_d15696d0e541ead772db817b36\` ON \`posMaster\``);
await queryRunner.query(`DROP INDEX \`REL_dca00872043f09a74af1d5172f\` ON \`posMaster\``);
await queryRunner.query(`DROP INDEX \`REL_49d2dcf6c8bd789ca99df7dc0d\` ON \`profile\``);
await queryRunner.query(`DROP INDEX \`REL_b5bfc34771c02a8078b9bf8944\` ON \`profile\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`citizenId\``);
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`citizenId\` int NULL COMMENT 'เลขประจำตัวประชาชน'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP INDEX \`IDX_d15696d0e541ead772db817b36\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`nextHolderId\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP INDEX \`IDX_dca00872043f09a74af1d5172f\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`currentHolderId\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP INDEX \`IDX_49d2dcf6c8bd789ca99df7dc0d\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`nextHolderId\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP INDEX \`IDX_b5bfc34771c02a8078b9bf8944\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`currentHolderId\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_9d29f52dcf499db3a5e8209b6dc\` FOREIGN KEY (\`profileIdNextHolder\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_1acc4ba5b4af308f0d8a1b7b249\` FOREIGN KEY (\`profileIdCurrentHolder\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}

View file

@ -1,56 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableProfile31707207718721 implements MigrationInterface {
name = 'AddTableProfile31707207718721'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_d15696d0e541ead772db817b36a\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_dca00872043f09a74af1d5172f3\``);
await queryRunner.query(`DROP INDEX \`FK_1acc4ba5b4af308f0d8a1b7b249\` ON \`posMaster\``);
await queryRunner.query(`DROP INDEX \`FK_9d29f52dcf499db3a5e8209b6dc\` ON \`posMaster\``);
await queryRunner.query(`DROP INDEX \`IDX_d15696d0e541ead772db817b36\` ON \`posMaster\``);
await queryRunner.query(`DROP INDEX \`IDX_dca00872043f09a74af1d5172f\` ON \`posMaster\``);
await queryRunner.query(`DROP INDEX \`REL_d15696d0e541ead772db817b36\` ON \`posMaster\``);
await queryRunner.query(`DROP INDEX \`REL_dca00872043f09a74af1d5172f\` ON \`posMaster\``);
await queryRunner.query(`DROP INDEX \`IDX_49d2dcf6c8bd789ca99df7dc0d\` ON \`profile\``);
await queryRunner.query(`DROP INDEX \`IDX_b5bfc34771c02a8078b9bf8944\` ON \`profile\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`currentHolderId\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`nextHolderId\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`profileIdCurrentHolder\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`profileIdNextHolder\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`current_holderId\` varchar(40) NULL COMMENT 'คนครองปัจจุบัน เมื่อทำสำเนาโครงสร้างและตำแหน่งพร้อมกับคนครองมา คนครองจะอยู่ในฟิลด์นี้'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD UNIQUE INDEX \`IDX_9f765a0fef405dfafbd1b5f6c0\` (\`current_holderId\`)`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`next_holderId\` varchar(40) NULL COMMENT 'คนที่กำลังจะมาครอง ตอนปรับโครงสร้าง ถ้าเลือกให้ใครมาครอง ProfileId ของคนนั้นจะมาอยู่ในช่องนี้ รวมทั้งตอนเลือกตำแหน่งเพื่อบรรจุ แต่งตั้ง เลื่อน ย้าย ในระบบบรรจุแต่งตั้งด้วย'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD UNIQUE INDEX \`IDX_22499e79738c6873fc7ede3f6d\` (\`next_holderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_9f765a0fef405dfafbd1b5f6c0\` ON \`posMaster\` (\`current_holderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_22499e79738c6873fc7ede3f6d\` ON \`posMaster\` (\`next_holderId\`)`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_9f765a0fef405dfafbd1b5f6c0a\` FOREIGN KEY (\`current_holderId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_22499e79738c6873fc7ede3f6dd\` FOREIGN KEY (\`next_holderId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_22499e79738c6873fc7ede3f6dd\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_9f765a0fef405dfafbd1b5f6c0a\``);
await queryRunner.query(`DROP INDEX \`REL_22499e79738c6873fc7ede3f6d\` ON \`posMaster\``);
await queryRunner.query(`DROP INDEX \`REL_9f765a0fef405dfafbd1b5f6c0\` ON \`posMaster\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP INDEX \`IDX_22499e79738c6873fc7ede3f6d\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`next_holderId\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP INDEX \`IDX_9f765a0fef405dfafbd1b5f6c0\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`current_holderId\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`profileIdNextHolder\` varchar(40) NULL COMMENT 'คนที่กำลังจะมาครอง ตอนปรับโครงสร้าง ถ้าเลือกให้ใครมาครอง ProfileId ของคนนั้นจะมาอยู่ในช่องนี้ รวมทั้งตอนเลือกตำแหน่งเพื่อบรรจุ แต่งตั้ง เลื่อน ย้าย ในระบบบรรจุแต่งตั้งด้วย'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`profileIdCurrentHolder\` varchar(40) NULL COMMENT 'คนครองปัจจุบัน เมื่อทำสำเนาโครงสร้างและตำแหน่งพร้อมกับคนครองมา คนครองจะอยู่ในฟิลด์นี้'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`nextHolderId\` varchar(36) NULL`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`currentHolderId\` varchar(36) NULL`);
await queryRunner.query(`CREATE UNIQUE INDEX \`IDX_b5bfc34771c02a8078b9bf8944\` ON \`profile\` (\`currentHolderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`IDX_49d2dcf6c8bd789ca99df7dc0d\` ON \`profile\` (\`nextHolderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_dca00872043f09a74af1d5172f\` ON \`posMaster\` (\`currentHolderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_d15696d0e541ead772db817b36\` ON \`posMaster\` (\`nextHolderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`IDX_dca00872043f09a74af1d5172f\` ON \`posMaster\` (\`currentHolderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`IDX_d15696d0e541ead772db817b36\` ON \`posMaster\` (\`nextHolderId\`)`);
await queryRunner.query(`CREATE INDEX \`FK_9d29f52dcf499db3a5e8209b6dc\` ON \`posMaster\` (\`profileIdNextHolder\`)`);
await queryRunner.query(`CREATE INDEX \`FK_1acc4ba5b4af308f0d8a1b7b249\` ON \`posMaster\` (\`profileIdCurrentHolder\`)`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_dca00872043f09a74af1d5172f3\` FOREIGN KEY (\`currentHolderId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_d15696d0e541ead772db817b36a\` FOREIGN KEY (\`nextHolderId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}

View file

@ -1,44 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableProfile41707207914350 implements MigrationInterface {
name = 'AddTableProfile41707207914350'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_49d2dcf6c8bd789ca99df7dc0d4\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_b5bfc34771c02a8078b9bf89445\``);
await queryRunner.query(`DROP INDEX \`IDX_22499e79738c6873fc7ede3f6d\` ON \`posMaster\``);
await queryRunner.query(`DROP INDEX \`IDX_9f765a0fef405dfafbd1b5f6c0\` ON \`posMaster\``);
await queryRunner.query(`DROP INDEX \`REL_49d2dcf6c8bd789ca99df7dc0d\` ON \`profile\``);
await queryRunner.query(`DROP INDEX \`REL_b5bfc34771c02a8078b9bf8944\` ON \`profile\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`currentHolderId\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`nextHolderId\``);
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`current_holderId\` varchar(40) NULL COMMENT 'คนครองปัจจุบัน เมื่อทำสำเนาโครงสร้างและตำแหน่งพร้อมกับคนครองมา คนครองจะอยู่ในฟิลด์นี้'`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD UNIQUE INDEX \`IDX_ee79137a2909faa188c20a7041\` (\`current_holderId\`)`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`next_holderId\` varchar(40) NULL COMMENT 'คนที่กำลังจะมาครอง ตอนปรับโครงสร้าง ถ้าเลือกให้ใครมาครอง ProfileId ของคนนั้นจะมาอยู่ในช่องนี้ รวมทั้งตอนเลือกตำแหน่งเพื่อบรรจุ แต่งตั้ง เลื่อน ย้าย ในระบบบรรจุแต่งตั้งด้วย'`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD UNIQUE INDEX \`IDX_c2ff3f61c281ece7f3ab5a2c20\` (\`next_holderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_ee79137a2909faa188c20a7041\` ON \`profile\` (\`current_holderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_c2ff3f61c281ece7f3ab5a2c20\` ON \`profile\` (\`next_holderId\`)`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_ee79137a2909faa188c20a70413\` FOREIGN KEY (\`current_holderId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_c2ff3f61c281ece7f3ab5a2c20b\` FOREIGN KEY (\`next_holderId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_c2ff3f61c281ece7f3ab5a2c20b\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_ee79137a2909faa188c20a70413\``);
await queryRunner.query(`DROP INDEX \`REL_c2ff3f61c281ece7f3ab5a2c20\` ON \`profile\``);
await queryRunner.query(`DROP INDEX \`REL_ee79137a2909faa188c20a7041\` ON \`profile\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP INDEX \`IDX_c2ff3f61c281ece7f3ab5a2c20\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`next_holderId\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP INDEX \`IDX_ee79137a2909faa188c20a7041\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`current_holderId\``);
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`nextHolderId\` varchar(36) NULL`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`currentHolderId\` varchar(36) NULL`);
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_b5bfc34771c02a8078b9bf8944\` ON \`profile\` (\`currentHolderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_49d2dcf6c8bd789ca99df7dc0d\` ON \`profile\` (\`nextHolderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`IDX_9f765a0fef405dfafbd1b5f6c0\` ON \`posMaster\` (\`current_holderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`IDX_22499e79738c6873fc7ede3f6d\` ON \`posMaster\` (\`next_holderId\`)`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_b5bfc34771c02a8078b9bf89445\` FOREIGN KEY (\`currentHolderId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_49d2dcf6c8bd789ca99df7dc0d4\` FOREIGN KEY (\`nextHolderId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}

View file

@ -1,40 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableProfile51707208924575 implements MigrationInterface {
name = 'AddTableProfile51707208924575'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_22499e79738c6873fc7ede3f6dd\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_9f765a0fef405dfafbd1b5f6c0a\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_ee79137a2909faa188c20a70413\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_c2ff3f61c281ece7f3ab5a2c20b\``);
await queryRunner.query(`DROP INDEX \`REL_22499e79738c6873fc7ede3f6d\` ON \`posMaster\``);
await queryRunner.query(`DROP INDEX \`REL_9f765a0fef405dfafbd1b5f6c0\` ON \`posMaster\``);
await queryRunner.query(`DROP INDEX \`IDX_c2ff3f61c281ece7f3ab5a2c20\` ON \`profile\``);
await queryRunner.query(`DROP INDEX \`IDX_ee79137a2909faa188c20a7041\` ON \`profile\``);
await queryRunner.query(`DROP INDEX \`REL_c2ff3f61c281ece7f3ab5a2c20\` ON \`profile\``);
await queryRunner.query(`DROP INDEX \`REL_ee79137a2909faa188c20a7041\` ON \`profile\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`current_holderId\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`next_holderId\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_9f765a0fef405dfafbd1b5f6c0a\` FOREIGN KEY (\`current_holderId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_22499e79738c6873fc7ede3f6dd\` FOREIGN KEY (\`next_holderId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_22499e79738c6873fc7ede3f6dd\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_9f765a0fef405dfafbd1b5f6c0a\``);
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`next_holderId\` varchar(40) NULL COMMENT 'คนที่กำลังจะมาครอง ตอนปรับโครงสร้าง ถ้าเลือกให้ใครมาครอง ProfileId ของคนนั้นจะมาอยู่ในช่องนี้ รวมทั้งตอนเลือกตำแหน่งเพื่อบรรจุ แต่งตั้ง เลื่อน ย้าย ในระบบบรรจุแต่งตั้งด้วย'`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`current_holderId\` varchar(40) NULL COMMENT 'คนครองปัจจุบัน เมื่อทำสำเนาโครงสร้างและตำแหน่งพร้อมกับคนครองมา คนครองจะอยู่ในฟิลด์นี้'`);
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_ee79137a2909faa188c20a7041\` ON \`profile\` (\`current_holderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_c2ff3f61c281ece7f3ab5a2c20\` ON \`profile\` (\`next_holderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`IDX_ee79137a2909faa188c20a7041\` ON \`profile\` (\`current_holderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`IDX_c2ff3f61c281ece7f3ab5a2c20\` ON \`profile\` (\`next_holderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_9f765a0fef405dfafbd1b5f6c0\` ON \`posMaster\` (\`current_holderId\`)`);
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_22499e79738c6873fc7ede3f6d\` ON \`posMaster\` (\`next_holderId\`)`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_c2ff3f61c281ece7f3ab5a2c20b\` FOREIGN KEY (\`next_holderId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_ee79137a2909faa188c20a70413\` FOREIGN KEY (\`current_holderId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_9f765a0fef405dfafbd1b5f6c0a\` FOREIGN KEY (\`current_holderId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_22499e79738c6873fc7ede3f6dd\` FOREIGN KEY (\`next_holderId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}

View file

@ -1,20 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableProfile61707211501053 implements MigrationInterface {
name = 'AddTableProfile61707211501053'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_9f765a0fef405dfafbd1b5f6c0a\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_22499e79738c6873fc7ede3f6dd\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_9f765a0fef405dfafbd1b5f6c0a\` FOREIGN KEY (\`current_holderId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_22499e79738c6873fc7ede3f6dd\` FOREIGN KEY (\`next_holderId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_22499e79738c6873fc7ede3f6dd\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_9f765a0fef405dfafbd1b5f6c0a\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_22499e79738c6873fc7ede3f6dd\` FOREIGN KEY (\`next_holderId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_9f765a0fef405dfafbd1b5f6c0a\` FOREIGN KEY (\`current_holderId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}

View file

@ -1,22 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableProfileAddType11707279774838 implements MigrationInterface {
name = 'UpdateTableProfileAddType11707279774838'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`position\` varchar(255) NULL COMMENT 'ตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`posLevelId\` varchar(40) NULL COMMENT 'ไอดีระดับตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`posTypeId\` varchar(40) NULL COMMENT 'ไอดีประเภทตำแหน่'`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_9098aae6d26e1d5a274f90240ff\` FOREIGN KEY (\`posLevelId\`) REFERENCES \`posLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_de774e32853add3313ff44bd793\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_de774e32853add3313ff44bd793\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_9098aae6d26e1d5a274f90240ff\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`posTypeId\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`posLevelId\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`position\``);
}
}

View file

@ -1,14 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTablePosMasterIsSit1707306721668 implements MigrationInterface {
name = 'UpdateTablePosMasterIsSit1707306721668'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`isSit\` tinyint NOT NULL COMMENT 'นั่งทับตำแหน่งไหม' DEFAULT 0`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`isSit\``);
}
}

View file

@ -1,20 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableProfileAddKeycloak1708054669956 implements MigrationInterface {
name = 'UpdateTableProfileAddKeycloak1708054669956'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`keycloak\` varchar(40) NULL COMMENT 'id keycloak'`);
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_de774e32853add3313ff44bd793\``);
await queryRunner.query(`ALTER TABLE \`profile\` CHANGE \`posTypeId\` \`posTypeId\` varchar(40) NULL COMMENT 'ไอดีประเภทตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_de774e32853add3313ff44bd793\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profile\` DROP FOREIGN KEY \`FK_de774e32853add3313ff44bd793\``);
await queryRunner.query(`ALTER TABLE \`profile\` CHANGE \`posTypeId\` \`posTypeId\` varchar(40) NULL COMMENT 'ไอดีประเภทตำแหน่'`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD CONSTRAINT \`FK_de774e32853add3313ff44bd793\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`keycloak\``);
}
}

View file

@ -1,16 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableProfileAddEmail1708058097765 implements MigrationInterface {
name = 'UpdateTableProfileAddEmail1708058097765'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`email\` varchar(255) NULL COMMENT 'อีเมล'`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`phone\` varchar(20) NULL COMMENT 'เบอร์โทร'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`phone\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`email\``);
}
}

View file

@ -1,16 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTablePosAddIsSpecial1708423229800 implements MigrationInterface {
name = 'UpdateTablePosAddIsSpecial1708423229800'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posDict\` ADD \`isSpacial\` tinyint NOT NULL COMMENT 'ฉ' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`position\` ADD \`isSpacial\` tinyint NOT NULL COMMENT 'ฉ' DEFAULT 0`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`position\` DROP COLUMN \`isSpacial\``);
await queryRunner.query(`ALTER TABLE \`posDict\` DROP COLUMN \`isSpacial\``);
}
}

View file

@ -1,16 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTablePosAddIsSpecial11708423721800 implements MigrationInterface {
name = 'UpdateTablePosAddIsSpecial11708423721800'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posDict\` CHANGE \`isSpacial\` \`isSpecial\` tinyint NOT NULL COMMENT 'ฉ' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`isSpacial\` \`isSpecial\` tinyint NOT NULL COMMENT 'ฉ' DEFAULT '0'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`position\` CHANGE \`isSpecial\` \`isSpacial\` tinyint NOT NULL COMMENT 'ฉ' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`posDict\` CHANGE \`isSpecial\` \`isSpacial\` tinyint NOT NULL COMMENT 'ฉ' DEFAULT '0'`);
}
}

View file

@ -1,14 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableProfileAddProbation1708590016918 implements MigrationInterface {
name = 'UpdateTableProfileAddProbation1708590016918'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`isProbation\` tinyint NOT NULL COMMENT 'ทดลองปฏิบัติหน้าที่' DEFAULT 0`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`isProbation\``);
}
}

View file

@ -1,16 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class CreateProfileSalaryTable1708672520446 implements MigrationInterface {
name = 'CreateProfileSalaryTable1708672520446'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`profileSalary\` (\`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', \`date\` datetime NULL COMMENT 'วันที่', \`amount\` double NULL COMMENT 'เงินเดือนฐาน' DEFAULT '0', \`positionSalaryAmount\` double NULL COMMENT 'เงินประจำตำแหน่ง' DEFAULT '0', \`mouthSalaryAmount\` double NULL COMMENT 'เงินค่าตอบแทนรายเดือน' DEFAULT '0', \`profileId\` varchar(40) NOT NULL COMMENT 'ไอดีโปรไฟล์', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD CONSTRAINT \`FK_7534d36579c78107ba08a96be6f\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP FOREIGN KEY \`FK_7534d36579c78107ba08a96be6f\``);
await queryRunner.query(`DROP TABLE \`profileSalary\``);
}
}

View file

@ -1,18 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableSalaryProfileAddDiscipline1709884395224 implements MigrationInterface {
name = 'UpdateTableSalaryProfileAddDiscipline1709884395224'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`profileDiscipline\` (\`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', \`date\` datetime NULL COMMENT 'วันที่', \`profileId\` varchar(40) NOT NULL COMMENT 'ไอดีโปรไฟล์', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`dateRetire\` datetime NULL COMMENT 'วันที่พักราชการ'`);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` ADD CONSTRAINT \`FK_0031dcb981836876de8524eaff1\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` DROP FOREIGN KEY \`FK_0031dcb981836876de8524eaff1\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`dateRetire\``);
await queryRunner.query(`DROP TABLE \`profileDiscipline\``);
}
}

View file

@ -1,20 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableSalaryProfileAddBirthDate1710129049964 implements MigrationInterface {
name = 'UpdateTableSalaryProfileAddBirthDate1710129049964'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`birthDate\` datetime NULL COMMENT 'วันเกิด'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP FOREIGN KEY \`FK_7534d36579c78107ba08a96be6f\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` CHANGE \`profileId\` \`profileId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง profile'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD CONSTRAINT \`FK_7534d36579c78107ba08a96be6f\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP FOREIGN KEY \`FK_7534d36579c78107ba08a96be6f\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` CHANGE \`profileId\` \`profileId\` varchar(40) NOT NULL COMMENT 'ไอดีโปรไฟล์'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD CONSTRAINT \`FK_7534d36579c78107ba08a96be6f\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`birthDate\``);
}
}

View file

@ -1,24 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableEmployees1710220097101 implements MigrationInterface {
name = 'AddTableEmployees1710220097101'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`employeePosType\` (\`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', \`posTypeName\` varchar(255) NULL COMMENT 'ชื่อกลุ่มงาน', \`posTypeRank\` int NOT NULL COMMENT 'ระดับของกลุ่มงาน', \`posTypeShortName\` varchar(255) NULL COMMENT 'ชื่อย่อกลุ่มงาน', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`employeePosDict\` (\`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', \`posDictName\` varchar(255) NULL COMMENT 'ชื่อตำแหน่ง', \`employeePosTypeId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง employeePosType', \`employeePosLevelId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง employeePosLevel', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`employeePosLevel\` (\`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', \`posLevelName\` varchar(255) NULL COMMENT 'ชื่อระดับชั้นงาน', \`posLevelRank\` int NOT NULL COMMENT 'ระดับของระดับชั้นงาน', \`employeePosTypeId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง employeePosType', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` ADD CONSTRAINT \`FK_73ad56ef383399f567d58b213e2\` FOREIGN KEY (\`employeePosTypeId\`) REFERENCES \`employeePosType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` ADD CONSTRAINT \`FK_28d45cec912604b7d6f3dfac39a\` FOREIGN KEY (\`employeePosLevelId\`) REFERENCES \`employeePosLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosLevel\` ADD CONSTRAINT \`FK_a822851af7b58288be65debfdd5\` FOREIGN KEY (\`employeePosTypeId\`) REFERENCES \`employeePosType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`employeePosLevel\` DROP FOREIGN KEY \`FK_a822851af7b58288be65debfdd5\``);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` DROP FOREIGN KEY \`FK_28d45cec912604b7d6f3dfac39a\``);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` DROP FOREIGN KEY \`FK_73ad56ef383399f567d58b213e2\``);
await queryRunner.query(`DROP TABLE \`employeePosLevel\``);
await queryRunner.query(`DROP TABLE \`employeePosDict\``);
await queryRunner.query(`DROP TABLE \`employeePosType\``);
}
}

View file

@ -1,16 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class EditTypeEmpPosLevel1710220658926 implements MigrationInterface {
name = 'EditTypeEmpPosLevel1710220658926'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`employeePosLevel\` DROP COLUMN \`posLevelName\``);
await queryRunner.query(`ALTER TABLE \`employeePosLevel\` ADD \`posLevelName\` int NOT NULL COMMENT 'ชื่อระดับชั้นงาน'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`employeePosLevel\` DROP COLUMN \`posLevelName\``);
await queryRunner.query(`ALTER TABLE \`employeePosLevel\` ADD \`posLevelName\` varchar(255) NULL COMMENT 'ชื่อระดับชั้นงาน'`);
}
}

View file

@ -1,60 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdatedTableOrgPart11710230685043 implements MigrationInterface {
name = 'UpdatedTableOrgPart11710230685043'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`profileCertificateHistory\` (\`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', \`expireDate\` datetime NULL COMMENT 'วันที่หมดอายุ', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`issueDate\` datetime NULL COMMENT 'วันที่ออกใบอนุญาต', \`certificateNo\` varchar(20) NULL COMMENT 'เลขที่ใบอนุญาต', \`certificateType\` varchar(100) NULL COMMENT 'ชื่อใบอนุญาต', \`issuer\` varchar(200) NULL COMMENT 'หน่วยงานผู้ออกใบอนุญาต', \`profileCertificateId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileCertificate', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileCertificate\` (\`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', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', \`expireDate\` datetime NULL COMMENT 'วันที่หมดอายุ', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`issueDate\` datetime NULL COMMENT 'วันที่ออกใบอนุญาต', \`certificateNo\` varchar(20) NULL COMMENT 'เลขที่ใบอนุญาต', \`certificateType\` varchar(100) NULL COMMENT 'ชื่อใบอนุญาต', \`issuer\` varchar(200) NULL COMMENT 'หน่วยงานผู้ออกใบอนุญาต', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileEducationHistory\` (\`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', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`country\` varchar(1000) NULL COMMENT 'ประเทศ', \`degree\` varchar(200) NULL COMMENT 'วุฒิการศึกษา', \`duration\` varchar(1000) NULL COMMENT 'ระยะเวลา', \`durationYear\` int NOT NULL COMMENT 'ระยะเวลาหลักสูตร', \`field\` varchar(200) NULL COMMENT 'สาขาวิชา/ทาง', \`finishDate\` datetime NULL COMMENT 'วันที่สำเร็จการศึกษา', \`fundName\` varchar(1000) NULL COMMENT 'ทุน', \`gpa\` varchar(20) NULL COMMENT 'เกรดเฉลี่ย', \`institute\` varchar(1000) NULL COMMENT 'สถานศึกษา', \`other\` varchar(1000) NULL COMMENT 'ข้อมูลการติดต่อ', \`startDate\` datetime NULL COMMENT 'ตั้งแต่', \`endDate\` datetime NULL COMMENT 'ถึง', \`educationLevel\` text NULL COMMENT 'ระดับศึกษา', \`educationLevelId\` varchar(40) NULL COMMENT 'Id ระดับศึกษา', \`positionPath\` text NULL COMMENT 'เป็นวุฒิการศึกษาในตำแหน่ง', \`positionPathId\` varchar(40) NULL COMMENT 'Id เป็นวุฒิการศึกษาในตำแหน่ง', \`isDate\` tinyint NULL COMMENT 'ประเภทช่วงเวลาการศึกษา', \`isEducation\` tinyint NULL COMMENT 'เป็นวุฒิศึกษาในตำแหน่ง', \`profileEducationId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileEducation\` (\`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', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`country\` varchar(1000) NULL COMMENT 'ประเทศ', \`degree\` varchar(200) NULL COMMENT 'วุฒิการศึกษา', \`duration\` varchar(1000) NULL COMMENT 'ระยะเวลา', \`durationYear\` int NOT NULL COMMENT 'ระยะเวลาหลักสูตร', \`field\` varchar(200) NULL COMMENT 'สาขาวิชา/ทาง', \`finishDate\` datetime NULL COMMENT 'วันที่สำเร็จการศึกษา', \`fundName\` varchar(1000) NULL COMMENT 'ทุน', \`gpa\` varchar(20) NULL COMMENT 'เกรดเฉลี่ย', \`institute\` varchar(1000) NULL COMMENT 'สถานศึกษา', \`other\` varchar(1000) NULL COMMENT 'ข้อมูลการติดต่อ', \`startDate\` datetime NULL COMMENT 'ตั้งแต่', \`endDate\` datetime NULL COMMENT 'ถึง', \`educationLevel\` text NULL COMMENT 'ระดับศึกษา', \`educationLevelId\` varchar(40) NULL COMMENT 'Id ระดับศึกษา', \`positionPath\` text NULL COMMENT 'เป็นวุฒิการศึกษาในตำแหน่ง', \`positionPathId\` varchar(40) NULL COMMENT 'Id เป็นวุฒิการศึกษาในตำแหน่ง', \`isDate\` tinyint NULL COMMENT 'ประเภทช่วงเวลาการศึกษา', \`isEducation\` tinyint NULL COMMENT 'เป็นวุฒิศึกษาในตำแหน่ง', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileTrainingHistory\` (\`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', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`startDate\` datetime NULL COMMENT 'วันเริ่มต้นการฝึกอบรม/ดูงาน', \`endDate\` datetime NULL COMMENT 'วันสิ้นสุดการฝึกอบรม/ดูงาน', \`numberOrder\` varchar(200) NULL COMMENT 'เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ', \`topic\` varchar(200) NULL COMMENT 'หัวข้อการฝึกอบรม/ดูงาน', \`place\` varchar(200) NULL COMMENT 'สถานที่ฝึกอบรม/ดูงาน', \`dateOrder\` datetime NULL COMMENT 'คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่', \`department\` varchar(200) NULL COMMENT 'หน่วยงานที่รับผิดชอบจัดการฝึกอบรม/ดูงาน', \`duration\` varchar(200) NULL COMMENT 'รวมระยะเวลาในการฝึกอบรม/ดูงาน', \`name\` varchar(200) NULL COMMENT 'ชื่อโครงการ/หลักสูตรการฝึกอบรม', \`yearly\` int NULL COMMENT 'ปีที่อบรม (พ.ศ.)', \`profileTrainingId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileTraining', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileTraining\` (\`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', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`startDate\` datetime NULL COMMENT 'วันเริ่มต้นการฝึกอบรม/ดูงาน', \`endDate\` datetime NULL COMMENT 'วันสิ้นสุดการฝึกอบรม/ดูงาน', \`numberOrder\` varchar(200) NULL COMMENT 'เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ', \`topic\` varchar(200) NULL COMMENT 'หัวข้อการฝึกอบรม/ดูงาน', \`place\` varchar(200) NULL COMMENT 'สถานที่ฝึกอบรม/ดูงาน', \`dateOrder\` datetime NULL COMMENT 'คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่', \`department\` varchar(200) NULL COMMENT 'หน่วยงานที่รับผิดชอบจัดการฝึกอบรม/ดูงาน', \`duration\` varchar(200) NULL COMMENT 'รวมระยะเวลาในการฝึกอบรม/ดูงาน', \`name\` varchar(200) NULL COMMENT 'ชื่อโครงการ/หลักสูตรการฝึกอบรม', \`yearly\` int NULL COMMENT 'ปีที่อบรม (พ.ศ.)', \`isDate\` tinyint NULL COMMENT 'ประเภทช่วงเวลาการศึกษา', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileInsigniaHistory\` (\`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', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`year\` int NOT NULL COMMENT 'ปีที่ยื่นขอ', \`no\` varchar(20) NULL COMMENT 'ลำดับที่', \`volume\` varchar(30) NULL COMMENT 'เล่ม', \`section\` varchar(30) NULL COMMENT 'ตอน', \`page\` varchar(30) NULL COMMENT 'หน้า', \`receiveDate\` datetime NULL COMMENT 'ลงวันที่', \`insigniaId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Insignia', \`insigniaType\` text NULL COMMENT 'ประเภท', \`dateAnnounce\` datetime NULL COMMENT 'วันที่ประกาศในราชกิจจาฯ', \`issue\` varchar(300) NULL COMMENT 'ราชกิจจาฯ ฉบับที่', \`volumeNo\` varchar(30) NULL COMMENT 'เล่มที่', \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)', \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)', \`profileInsigniaId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileInsignia', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileInsignia\` (\`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', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`year\` int NOT NULL COMMENT 'ปีที่ยื่นขอ', \`no\` varchar(20) NULL COMMENT 'ลำดับที่', \`volume\` varchar(30) NULL COMMENT 'เล่ม', \`section\` varchar(30) NULL COMMENT 'ตอน', \`page\` varchar(30) NULL COMMENT 'หน้า', \`receiveDate\` datetime NULL COMMENT 'ลงวันที่', \`insigniaId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Insignia', \`insigniaType\` text NULL COMMENT 'ประเภท', \`dateAnnounce\` datetime NULL COMMENT 'วันที่ประกาศในราชกิจจาฯ', \`issue\` varchar(300) NULL COMMENT 'ราชกิจจาฯ ฉบับที่', \`volumeNo\` varchar(30) NULL COMMENT 'เล่มที่', \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)', \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileHonorHistory\` (\`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', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`detail\` varchar(2000) NULL COMMENT 'รายละเอียด', \`issueDate\` datetime NULL COMMENT 'วันที่ได้รับ', \`issuer\` varchar(200) NULL COMMENT 'หน่วยงานที่ออก', \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)', \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)', \`profileHonorId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileHonor', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileHonor\` (\`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', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`detail\` varchar(2000) NULL COMMENT 'รายละเอียด', \`issueDate\` datetime NULL COMMENT 'วันที่ได้รับ', \`issuer\` varchar(200) NULL COMMENT 'หน่วยงานที่ออก', \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)', \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)', \`isDate\` tinyint NULL COMMENT 'ประเภทช่วงเวลาการศึกษา', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileAssessmentHistory\` (\`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', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`name\` text NULL COMMENT 'ชื่อแบบประเมิน', \`date\` datetime NULL COMMENT 'วันที่ได้รับ', \`point1\` double NULL COMMENT 'ผลประเมินส่วนที่1 (คะแนน)', \`point1Total\` double NULL COMMENT 'ส่วนที่1 (คะแนน)', \`point2\` double NULL COMMENT 'ผลประเมินส่วนที่2 (คะแนน)', \`point2Total\` double NULL COMMENT 'ส่วนที่2 (คะแนน)', \`pointSum\` double NULL COMMENT 'ผลประเมินรวม (คะแนน)', \`pointSumTotal\` double NULL COMMENT 'ผลรวม (คะแนน)', \`profileAssessmentId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileAssessment', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileAssessment\` (\`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', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`name\` text NULL COMMENT 'ชื่อแบบประเมิน', \`date\` datetime NULL COMMENT 'วันที่ได้รับ', \`point1\` double NULL COMMENT 'ผลประเมินส่วนที่1 (คะแนน)', \`point1Total\` double NULL COMMENT 'ส่วนที่1 (คะแนน)', \`point2\` double NULL COMMENT 'ผลประเมินส่วนที่2 (คะแนน)', \`point2Total\` double NULL COMMENT 'ส่วนที่2 (คะแนน)', \`pointSum\` double NULL COMMENT 'ผลประเมินรวม (คะแนน)', \`pointSumTotal\` double NULL COMMENT 'ผลรวม (คะแนน)', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`profileCertificateHistory\` ADD CONSTRAINT \`FK_5c102688c6090f77eb71f77fff3\` FOREIGN KEY (\`profileCertificateId\`) REFERENCES \`profileCertificate\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileCertificate\` ADD CONSTRAINT \`FK_9aac428db340fb17d1cd3085f8e\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileEducationHistory\` ADD CONSTRAINT \`FK_5791a831778c5072ef78cb05836\` FOREIGN KEY (\`profileEducationId\`) REFERENCES \`profileEducation\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileEducation\` ADD CONSTRAINT \`FK_419783fbd9ed50a8954fc2a75f5\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileTrainingHistory\` ADD CONSTRAINT \`FK_d5d532a4f4828960255d74d94a2\` FOREIGN KEY (\`profileTrainingId\`) REFERENCES \`profileTraining\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileTraining\` ADD CONSTRAINT \`FK_e2e9c92f7e6d39085120a84a89d\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileInsigniaHistory\` ADD CONSTRAINT \`FK_5b67ab78ba429a3fa7e1122d913\` FOREIGN KEY (\`profileInsigniaId\`) REFERENCES \`profileInsignia\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileInsignia\` ADD CONSTRAINT \`FK_74a90a61c6cb226b39b22ec2fdd\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileHonorHistory\` ADD CONSTRAINT \`FK_13f1669c5c3dfbfb79b6370bd90\` FOREIGN KEY (\`profileHonorId\`) REFERENCES \`profileHonor\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileHonor\` ADD CONSTRAINT \`FK_d1f34c886700557859a5f2d8253\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileAssessmentHistory\` ADD CONSTRAINT \`FK_086f372ac9c1344fa131a1bfb8a\` FOREIGN KEY (\`profileAssessmentId\`) REFERENCES \`profileAssessment\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileAssessment\` ADD CONSTRAINT \`FK_d955d4dbcc7ea53160354832ca8\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileAssessment\` DROP FOREIGN KEY \`FK_d955d4dbcc7ea53160354832ca8\``);
await queryRunner.query(`ALTER TABLE \`profileAssessmentHistory\` DROP FOREIGN KEY \`FK_086f372ac9c1344fa131a1bfb8a\``);
await queryRunner.query(`ALTER TABLE \`profileHonor\` DROP FOREIGN KEY \`FK_d1f34c886700557859a5f2d8253\``);
await queryRunner.query(`ALTER TABLE \`profileHonorHistory\` DROP FOREIGN KEY \`FK_13f1669c5c3dfbfb79b6370bd90\``);
await queryRunner.query(`ALTER TABLE \`profileInsignia\` DROP FOREIGN KEY \`FK_74a90a61c6cb226b39b22ec2fdd\``);
await queryRunner.query(`ALTER TABLE \`profileInsigniaHistory\` DROP FOREIGN KEY \`FK_5b67ab78ba429a3fa7e1122d913\``);
await queryRunner.query(`ALTER TABLE \`profileTraining\` DROP FOREIGN KEY \`FK_e2e9c92f7e6d39085120a84a89d\``);
await queryRunner.query(`ALTER TABLE \`profileTrainingHistory\` DROP FOREIGN KEY \`FK_d5d532a4f4828960255d74d94a2\``);
await queryRunner.query(`ALTER TABLE \`profileEducation\` DROP FOREIGN KEY \`FK_419783fbd9ed50a8954fc2a75f5\``);
await queryRunner.query(`ALTER TABLE \`profileEducationHistory\` DROP FOREIGN KEY \`FK_5791a831778c5072ef78cb05836\``);
await queryRunner.query(`ALTER TABLE \`profileCertificate\` DROP FOREIGN KEY \`FK_9aac428db340fb17d1cd3085f8e\``);
await queryRunner.query(`ALTER TABLE \`profileCertificateHistory\` DROP FOREIGN KEY \`FK_5c102688c6090f77eb71f77fff3\``);
await queryRunner.query(`DROP TABLE \`profileAssessment\``);
await queryRunner.query(`DROP TABLE \`profileAssessmentHistory\``);
await queryRunner.query(`DROP TABLE \`profileHonor\``);
await queryRunner.query(`DROP TABLE \`profileHonorHistory\``);
await queryRunner.query(`DROP TABLE \`profileInsignia\``);
await queryRunner.query(`DROP TABLE \`profileInsigniaHistory\``);
await queryRunner.query(`DROP TABLE \`profileTraining\``);
await queryRunner.query(`DROP TABLE \`profileTrainingHistory\``);
await queryRunner.query(`DROP TABLE \`profileEducation\``);
await queryRunner.query(`DROP TABLE \`profileEducationHistory\``);
await queryRunner.query(`DROP TABLE \`profileCertificate\``);
await queryRunner.query(`DROP TABLE \`profileCertificateHistory\``);
}
}

View file

@ -1,38 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableChildRanksub1710298184697 implements MigrationInterface {
name = 'UpdateTableChildRanksub1710298184697'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`profileLeaveHistory\` (\`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', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`dateStartLeave\` datetime NULL COMMENT 'วัน เดือน ปี ที่เริ่มลา', \`dateEndLeave\` datetime NULL COMMENT 'วัน เดือน ปี ที่สิ้นสุดลา', \`numLeave\` double NULL COMMENT 'ลาครั้งที่', \`sumLeave\` double NULL COMMENT 'ลามาแล้ว', \`totalLeave\` double NULL COMMENT 'รวมเป็น', \`status\` text NULL COMMENT 'สถานะ', \`typeLeaveId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง TypeLeave', \`reason\` text NULL COMMENT 'เหตุผล', \`profileLeaveId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileLeave', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileLeave\` (\`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', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`restCount\` double NULL, \`restDay\` double NULL, \`sickCount\` double NULL COMMENT 'ลาพักผ่อน (วัน)', \`sickDay\` double NULL COMMENT 'ลาป่วย (วัน)', \`otherDay\` double NULL, \`personalCount\` double NULL, \`personalDay\` double NULL COMMENT 'ลากิจส่วนตัว (วัน)', \`studyCount\` double NULL, \`absentCount\` double NULL, \`absentDay\` double NULL COMMENT 'ลาเข้ารับการตรวจเลือกหรือเข้ารับการเตรียมพล (วัน)', \`agencyCount\` double NULL, \`agencyDay\` double NULL COMMENT 'ลาไปปฏิบัติงานในองค์การระหว่างประเทศ (วัน)', \`coupleCount\` double NULL, \`coupleDay\` double NULL COMMENT 'ลาติดตามคู่สมรส (วัน)', \`lateCount\` double NULL, \`lateDay\` double NULL, \`maternityCount\` double NULL, \`maternityDay\` double NULL COMMENT 'ลาคลอดบุตร (วัน)', \`militaryCount\` double NULL, \`militaryDay\` double NULL, \`ordainCount\` double NULL, \`ordainDay\` double NULL COMMENT 'ลาอุปสมบทหรือการลาประกอบพิธีฮัจย์ฯ (วัน)', \`otherCount\` double NULL, \`dateStartLeave\` datetime NULL COMMENT 'วัน เดือน ปี ที่เริ่มลา', \`dateEndLeave\` datetime NULL COMMENT 'วัน เดือน ปี ที่สิ้นสุดลา', \`numLeave\` double NULL COMMENT 'ลาครั้งที่', \`sumLeave\` double NULL COMMENT 'ลามาแล้ว', \`totalLeave\` double NULL COMMENT 'รวมเป็น', \`status\` text NULL COMMENT 'สถานะ', \`typeLeaveId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง TypeLeave', \`reason\` text NULL COMMENT 'เหตุผล', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileAbilityHistory\` (\`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', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`remark\` text NULL COMMENT 'หมายเหตุ', \`detail\` text NULL COMMENT 'รายละเอียด', \`reference\` text NULL COMMENT 'เอกสารอ้างอิง', \`dateStart\` datetime NULL COMMENT 'วันที่เริ่มต้น', \`dateEnd\` datetime NULL COMMENT 'วันที่สิ้นสุด', \`field\` text NULL COMMENT 'ด้าน', \`profileAbilityId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileAbility', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileAbility\` (\`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', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`remark\` text NULL COMMENT 'หมายเหตุ', \`detail\` text NULL COMMENT 'รายละเอียด', \`reference\` text NULL COMMENT 'เอกสารอ้างอิง', \`dateStart\` datetime NULL COMMENT 'วันที่เริ่มต้น', \`dateEnd\` datetime NULL COMMENT 'วันที่สิ้นสุด', \`field\` text NULL COMMENT 'ด้าน', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD \`orgChild4RankSub\` varchar(255) NULL COMMENT 'ระดับส่วนราชการsub'`);
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD \`orgChild3RankSub\` varchar(255) NULL COMMENT 'ระดับส่วนราชการsub'`);
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD \`orgChild2RankSub\` varchar(255) NULL COMMENT 'ระดับส่วนราชการsub'`);
await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD \`orgChild1RankSub\` varchar(255) NULL COMMENT 'ระดับส่วนราชการsub'`);
await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD \`orgRootRankSub\` varchar(255) NULL COMMENT 'ระดับส่วนราชการsub'`);
await queryRunner.query(`ALTER TABLE \`profileLeaveHistory\` ADD CONSTRAINT \`FK_0fc535910e41657c584a569b8a6\` FOREIGN KEY (\`profileLeaveId\`) REFERENCES \`profileLeave\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileLeave\` ADD CONSTRAINT \`FK_ddae7e2a7ac1ac97be4a8b6bcc8\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileAbilityHistory\` ADD CONSTRAINT \`FK_1af20fbd56b675ee6777227967d\` FOREIGN KEY (\`profileAbilityId\`) REFERENCES \`profileAbility\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileAbility\` ADD CONSTRAINT \`FK_c15373efe7ca78db8b7aab26afb\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileAbility\` DROP FOREIGN KEY \`FK_c15373efe7ca78db8b7aab26afb\``);
await queryRunner.query(`ALTER TABLE \`profileAbilityHistory\` DROP FOREIGN KEY \`FK_1af20fbd56b675ee6777227967d\``);
await queryRunner.query(`ALTER TABLE \`profileLeave\` DROP FOREIGN KEY \`FK_ddae7e2a7ac1ac97be4a8b6bcc8\``);
await queryRunner.query(`ALTER TABLE \`profileLeaveHistory\` DROP FOREIGN KEY \`FK_0fc535910e41657c584a569b8a6\``);
await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP COLUMN \`orgRootRankSub\``);
await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP COLUMN \`orgChild1RankSub\``);
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP COLUMN \`orgChild2RankSub\``);
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP COLUMN \`orgChild3RankSub\``);
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP COLUMN \`orgChild4RankSub\``);
await queryRunner.query(`DROP TABLE \`profileAbility\``);
await queryRunner.query(`DROP TABLE \`profileAbilityHistory\``);
await queryRunner.query(`DROP TABLE \`profileLeave\``);
await queryRunner.query(`DROP TABLE \`profileLeaveHistory\``);
}
}

View file

@ -1,104 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableProfileSalaryhis1710301899335 implements MigrationInterface {
name = 'AddTableProfileSalaryhis1710301899335'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`profileSalaryHistory\` (\`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', \`date\` datetime NULL COMMENT 'วันที่', \`amount\` double NULL COMMENT 'เงินเดือนฐาน' DEFAULT '0', \`positionSalaryAmount\` double NULL COMMENT 'เงินประจำตำแหน่ง' DEFAULT '0', \`mouthSalaryAmount\` double NULL COMMENT 'เงินค่าตอบแทนรายเดือน' DEFAULT '0', \`profileId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง profile', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`salaryClass\` text NULL COMMENT 'ตำแหน่ง (รายละเอียด)', \`salaryRef\` text NULL COMMENT 'เอกสารอ้างอิง', \`posNoId\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่ง', \`positionId\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่ง', \`ocId\` varchar(40) NULL COMMENT 'Id สังกัด', \`positionExecutiveId\` varchar(40) NULL COMMENT 'Id ตำแหน่งทางการบริหาร', \`positionExecutiveSideId\` varchar(40) NULL COMMENT 'Id ด้านทางการบริหาร', \`positionLevelId\` varchar(40) NULL, \`positionLineId\` varchar(40) NULL COMMENT 'Id สายงาน', \`positionPathSideId\` varchar(40) NULL COMMENT 'Id ด้าน/สาขา', \`positionTypeId\` varchar(40) NULL COMMENT 'Id ประเภทตำแหน่ง', \`organizationShortNameId\` varchar(40) NULL COMMENT 'Id ชื่อย่อหน่วยงาน', \`positionEmployeeGroupId\` varchar(40) NULL COMMENT 'Id กลุ่มงาน', \`positionEmployeeLevelId\` varchar(40) NULL COMMENT 'Id ระดับชั้นงาน', \`positionEmployeePositionId\` varchar(40) NULL COMMENT 'Id ตำแหน่ง', \`positionEmployeePositionSideId\` varchar(40) NULL COMMENT 'Id ด้านของตำแหน่ง', \`posNoEmployee\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่งลูกจ้าง', \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)', \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)', \`order\` int NULL COMMENT 'ลำดับ', \`commandNo\` text NOT NULL COMMENT 'เลขที่คำสั่ง', \`commandTypeName\` text NOT NULL COMMENT 'ประเภทคำสั่ง', \`salaryStatus\` text NULL COMMENT 'ประเภทตำแหน่งกรณีพิเศษ', \`profileSalaryId\` varchar(36) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileDisciplineHistory\` (\`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', \`date\` datetime NULL COMMENT 'วันที่', \`profileDisciplineId\` varchar(40) NOT NULL COMMENT 'ล้างมลทิน', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`level\` text NULL COMMENT 'ระดับความผิด', \`detail\` text NULL COMMENT 'รายละเอียด', \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)', \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)', \`unStigma\` text NULL COMMENT 'ล้างมลทิน', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileDutyHistory\` (\`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', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`dateStart\` datetime NULL COMMENT 'เริ่มต้น', \`dateEnd\` datetime NULL COMMENT 'สิ้นสุด', \`detail\` text NULL COMMENT 'รายละเอียด', \`reference\` text NULL COMMENT 'เอกสารอ้างอิง', \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)', \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)', \`profileDutyId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileDuty', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileDuty\` (\`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', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`dateStart\` datetime NULL COMMENT 'เริ่มต้น', \`dateEnd\` datetime NULL COMMENT 'สิ้นสุด', \`detail\` text NULL COMMENT 'รายละเอียด', \`reference\` text NULL COMMENT 'เอกสารอ้างอิง', \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)', \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileNopaidHistory\` (\`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', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`date\` datetime NULL COMMENT 'วัน เดือน ปี', \`detail\` text NULL COMMENT 'รายละเอียด', \`reference\` text NULL COMMENT 'เอกสารอ้างอิง', \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)', \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)', \`profileNopaidId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileNopaid', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileNopaid\` (\`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', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`date\` datetime NULL COMMENT 'วัน เดือน ปี', \`detail\` text NULL COMMENT 'รายละเอียด', \`reference\` text NULL COMMENT 'เอกสารอ้างอิง', \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)', \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileOtherHistory\` (\`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', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`detail\` text NULL COMMENT 'รายละเอียด', \`date\` datetime NULL COMMENT 'วันที่', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileOther\` (\`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', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`detail\` text NULL COMMENT 'รายละเอียด', \`date\` datetime NULL COMMENT 'วันที่', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`salaryClass\` text NULL COMMENT 'ตำแหน่ง (รายละเอียด)'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`salaryRef\` text NULL COMMENT 'เอกสารอ้างอิง'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`posNoId\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionId\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`ocId\` varchar(40) NULL COMMENT 'Id สังกัด'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionExecutiveId\` varchar(40) NULL COMMENT 'Id ตำแหน่งทางการบริหาร'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionExecutiveSideId\` varchar(40) NULL COMMENT 'Id ด้านทางการบริหาร'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionLevelId\` varchar(40) NULL`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionLineId\` varchar(40) NULL COMMENT 'Id สายงาน'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionPathSideId\` varchar(40) NULL COMMENT 'Id ด้าน/สาขา'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionTypeId\` varchar(40) NULL COMMENT 'Id ประเภทตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`organizationShortNameId\` varchar(40) NULL COMMENT 'Id ชื่อย่อหน่วยงาน'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionEmployeeGroupId\` varchar(40) NULL COMMENT 'Id กลุ่มงาน'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionEmployeeLevelId\` varchar(40) NULL COMMENT 'Id ระดับชั้นงาน'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionEmployeePositionId\` varchar(40) NULL COMMENT 'Id ตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`positionEmployeePositionSideId\` varchar(40) NULL COMMENT 'Id ด้านของตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`posNoEmployee\` varchar(40) NULL COMMENT 'Id เลขที่ตำแหน่งลูกจ้าง'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`order\` int NULL COMMENT 'ลำดับ'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`commandNo\` text NOT NULL COMMENT 'เลขที่คำสั่ง'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`commandTypeName\` text NOT NULL COMMENT 'ประเภทคำสั่ง'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`salaryStatus\` text NULL COMMENT 'ประเภทตำแหน่งกรณีพิเศษ'`);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` ADD \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` ADD \`level\` text NULL COMMENT 'ระดับความผิด'`);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` ADD \`detail\` text NULL COMMENT 'รายละเอียด'`);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` ADD \`refCommandDate\` datetime NULL COMMENT 'เอกสารอ้างอิง (ลงวันที่)'`);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` ADD \`refCommandNo\` text NULL COMMENT 'เอกสารอ้างอิง (เลขที่คำสั่ง)'`);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` ADD \`unStigma\` text NULL COMMENT 'ล้างมลทิน'`);
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD CONSTRAINT \`FK_f1ded3e1f83ab2437f739a14f38\` FOREIGN KEY (\`profileSalaryId\`) REFERENCES \`profileSalary\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileDisciplineHistory\` ADD CONSTRAINT \`FK_5800d4d8fdfd3fd58d1e9085f88\` FOREIGN KEY (\`profileDisciplineId\`) REFERENCES \`profileDiscipline\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileDutyHistory\` ADD CONSTRAINT \`FK_cbd922448bdf0c4fc96a2837d4f\` FOREIGN KEY (\`profileDutyId\`) REFERENCES \`profileDuty\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileDuty\` ADD CONSTRAINT \`FK_7f5aa961bf71d86d8807aa8be4d\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileNopaidHistory\` ADD CONSTRAINT \`FK_c2b83aa33f3679e48b6bd521170\` FOREIGN KEY (\`profileNopaidId\`) REFERENCES \`profileNopaid\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileNopaid\` ADD CONSTRAINT \`FK_7b79e20b066ed08f3a85fd0fafa\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` ADD CONSTRAINT \`FK_3b1d1d213fd87c951ba518b8fbc\` FOREIGN KEY (\`profileId\`) REFERENCES \`profileOther\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileOther\` ADD CONSTRAINT \`FK_54fb3d8f5aaf823450209bacdc3\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileOther\` DROP FOREIGN KEY \`FK_54fb3d8f5aaf823450209bacdc3\``);
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` DROP FOREIGN KEY \`FK_3b1d1d213fd87c951ba518b8fbc\``);
await queryRunner.query(`ALTER TABLE \`profileNopaid\` DROP FOREIGN KEY \`FK_7b79e20b066ed08f3a85fd0fafa\``);
await queryRunner.query(`ALTER TABLE \`profileNopaidHistory\` DROP FOREIGN KEY \`FK_c2b83aa33f3679e48b6bd521170\``);
await queryRunner.query(`ALTER TABLE \`profileDuty\` DROP FOREIGN KEY \`FK_7f5aa961bf71d86d8807aa8be4d\``);
await queryRunner.query(`ALTER TABLE \`profileDutyHistory\` DROP FOREIGN KEY \`FK_cbd922448bdf0c4fc96a2837d4f\``);
await queryRunner.query(`ALTER TABLE \`profileDisciplineHistory\` DROP FOREIGN KEY \`FK_5800d4d8fdfd3fd58d1e9085f88\``);
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP FOREIGN KEY \`FK_f1ded3e1f83ab2437f739a14f38\``);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` DROP COLUMN \`unStigma\``);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` DROP COLUMN \`refCommandNo\``);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` DROP COLUMN \`refCommandDate\``);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` DROP COLUMN \`detail\``);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` DROP COLUMN \`level\``);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` DROP COLUMN \`isActive\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`salaryStatus\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`commandTypeName\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`commandNo\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`order\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`refCommandNo\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`refCommandDate\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`posNoEmployee\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionEmployeePositionSideId\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionEmployeePositionId\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionEmployeeLevelId\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionEmployeeGroupId\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`organizationShortNameId\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionTypeId\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionPathSideId\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionLineId\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionLevelId\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionExecutiveSideId\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionExecutiveId\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`ocId\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`positionId\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`posNoId\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`salaryRef\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`salaryClass\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`isActive\``);
await queryRunner.query(`DROP TABLE \`profileOther\``);
await queryRunner.query(`DROP TABLE \`profileOtherHistory\``);
await queryRunner.query(`DROP TABLE \`profileNopaid\``);
await queryRunner.query(`DROP TABLE \`profileNopaidHistory\``);
await queryRunner.query(`DROP TABLE \`profileDuty\``);
await queryRunner.query(`DROP TABLE \`profileDutyHistory\``);
await queryRunner.query(`DROP TABLE \`profileDisciplineHistory\``);
await queryRunner.query(`DROP TABLE \`profileSalaryHistory\``);
}
}

View file

@ -1,18 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableInsignia1710311804080 implements MigrationInterface {
name = 'AddTableInsignia1710311804080'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`insignia\` (\`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', \`name\` varchar(255) NULL COMMENT 'ชื่อเครื่องราช', \`shortName\` varchar(255) NULL COMMENT 'ชื่อย่อเครื่องราช', \`level\` int NULL COMMENT 'ลำดับชั้นของเครื่องราช เอาไว้ตรวจสอบเวลาขอว่าต้องได้ชั้นที่สูงกว่าที่เคยได้รับแล้วเท่านั้น', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, \`note\` varchar(255) NULL COMMENT 'หมายเหตุ', \`insigniaTypeId\` varchar(40) NOT NULL COMMENT 'id ประเภทเครื่องราช', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`insigniaType\` (\`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', \`name\` varchar(255) NULL COMMENT 'ชื่อประเภทเครื่องราช', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`insignia\` ADD CONSTRAINT \`FK_bf8cd951a7eb12a0eff9b17f82d\` FOREIGN KEY (\`insigniaTypeId\`) REFERENCES \`insigniaType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`insignia\` DROP FOREIGN KEY \`FK_bf8cd951a7eb12a0eff9b17f82d\``);
await queryRunner.query(`DROP TABLE \`insigniaType\``);
await queryRunner.query(`DROP TABLE \`insignia\``);
}
}

View file

@ -1,18 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableProfileduty1710323273630 implements MigrationInterface {
name = 'AddTableProfileduty1710323273630'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` DROP FOREIGN KEY \`FK_3b1d1d213fd87c951ba518b8fbc\``);
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` CHANGE \`profileId\` \`profileOtherId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile'`);
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` ADD CONSTRAINT \`FK_133a9a59af0754634e0d33f7613\` FOREIGN KEY (\`profileOtherId\`) REFERENCES \`profileOther\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` DROP FOREIGN KEY \`FK_133a9a59af0754634e0d33f7613\``);
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` CHANGE \`profileOtherId\` \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile'`);
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` ADD CONSTRAINT \`FK_3b1d1d213fd87c951ba518b8fbc\` FOREIGN KEY (\`profileId\`) REFERENCES \`profileOther\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}

View file

@ -1,38 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableEmployeePosition1710328629522 implements MigrationInterface {
name = 'AddTableEmployeePosition1710328629522'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`employeePosition\` (\`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', \`positionName\` varchar(255) NULL COMMENT 'ชื่อตำแหน่ง', \`posTypeId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง employeePosType', \`posLevelId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง employeePosLevel', \`positionIsSelected\` tinyint NOT NULL COMMENT 'เป็นตำแหน่งที่ถูกเลือกในรอบนั้นๆ หรือไม่?' DEFAULT 0, \`posMasterId\` varchar(40) NOT NULL COMMENT 'เชื่อมโยงกับตารางเลขที่ตำแหน่ง', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`employeePosMaster\` (\`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', \`posMasterNoPrefix\` varchar(16) NULL COMMENT 'Prefix นำหน้าเลขที่ตำแหน่ง เป็น Optional (ไม่ใช่อักษรย่อของหน่วยงาน/ส่วนราชการ)', \`posMasterNo\` int NULL COMMENT 'เลขที่ตำแหน่ง เป็นตัวเลข', \`posMasterNoSuffix\` varchar(16) NULL COMMENT 'Suffix หลังเลขที่ตำแหน่ง เช่น ช.', \`posMasterCreatedAt\` datetime NULL COMMENT 'วัน-เวลาที่สร้าง', \`ancestorDNA\` varchar(40) NULL COMMENT 'รหัส DNA ใช้ในกรณีที่มีการทำสำเนาโครงสร้างและตำแหน่ง ตำแหน่งที่ทำสำเนามากับตำแหน่งเก่าจะต้องมี DNA เดียวกัน เพื่อให้ track ประวัติการแก้ไขตำแหน่งย้อนหลังได้', \`posMasterOrder\` int NULL COMMENT 'ลำดับที่แสดงผล', \`posMasterPriority\` int NULL COMMENT 'ลำดับความสำคัญ', \`posMasterLine\` enum ('MAIN', 'SUPPORT') NULL COMMENT 'สายงานในอัตรากำลัง (หลัก / สนับสนุน) คนละฟิลด์กับสายงานของตำแหน่ง', \`isSit\` tinyint NOT NULL COMMENT 'นั่งทับตำแหน่งไหม' DEFAULT 0, \`orgRootId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgRoot', \`orgChild1Id\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild1', \`orgChild2Id\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild2', \`orgChild3Id\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild3', \`orgChild4Id\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild4', \`current_holderId\` varchar(40) NULL COMMENT 'คนครองปัจจุบัน เมื่อทำสำเนาโครงสร้างและตำแหน่งพร้อมกับคนครองมา คนครองจะอยู่ในฟิลด์นี้', \`next_holderId\` varchar(40) NULL COMMENT 'คนที่กำลังจะมาครอง ตอนปรับโครงสร้าง ถ้าเลือกให้ใครมาครอง ProfileId ของคนนั้นจะมาอยู่ในช่องนี้ รวมทั้งตอนเลือกตำแหน่งเพื่อบรรจุ แต่งตั้ง เลื่อน ย้าย ในระบบบรรจุแต่งตั้งด้วย', \`orgRevisionId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgRevision', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`employeePosition\` ADD CONSTRAINT \`FK_1c8174b8e11333448f250657c49\` FOREIGN KEY (\`posMasterId\`) REFERENCES \`employeePosMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosition\` ADD CONSTRAINT \`FK_c3b098a7bdf65ed6daec420d23e\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`employeePosType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosition\` ADD CONSTRAINT \`FK_ef5fcb52f3920d3029a334ae19e\` FOREIGN KEY (\`posLevelId\`) REFERENCES \`employeePosLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD CONSTRAINT \`FK_85b7778f4b345c6c214f47e4a8f\` FOREIGN KEY (\`orgRevisionId\`) REFERENCES \`orgRevision\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD CONSTRAINT \`FK_93aae3c3c292aadf0b3a4c9019e\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD CONSTRAINT \`FK_bbda5c4d36100593214af67f522\` FOREIGN KEY (\`orgChild1Id\`) REFERENCES \`orgChild1\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD CONSTRAINT \`FK_768a012f53f8cb3a87876a541f5\` FOREIGN KEY (\`orgChild2Id\`) REFERENCES \`orgChild2\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD CONSTRAINT \`FK_bce3a2a666b53ce5ac10aafbbfa\` FOREIGN KEY (\`orgChild3Id\`) REFERENCES \`orgChild3\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD CONSTRAINT \`FK_c6dd2d044ce9a06c2e8e0e8af0f\` FOREIGN KEY (\`orgChild4Id\`) REFERENCES \`orgChild4\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD CONSTRAINT \`FK_00221b20fdf6d460a86f108fc6d\` FOREIGN KEY (\`current_holderId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD CONSTRAINT \`FK_41945621a3f1e716dc3b2d994c3\` FOREIGN KEY (\`next_holderId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP FOREIGN KEY \`FK_41945621a3f1e716dc3b2d994c3\``);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP FOREIGN KEY \`FK_00221b20fdf6d460a86f108fc6d\``);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP FOREIGN KEY \`FK_c6dd2d044ce9a06c2e8e0e8af0f\``);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP FOREIGN KEY \`FK_bce3a2a666b53ce5ac10aafbbfa\``);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP FOREIGN KEY \`FK_768a012f53f8cb3a87876a541f5\``);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP FOREIGN KEY \`FK_bbda5c4d36100593214af67f522\``);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP FOREIGN KEY \`FK_93aae3c3c292aadf0b3a4c9019e\``);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP FOREIGN KEY \`FK_85b7778f4b345c6c214f47e4a8f\``);
await queryRunner.query(`ALTER TABLE \`employeePosition\` DROP FOREIGN KEY \`FK_ef5fcb52f3920d3029a334ae19e\``);
await queryRunner.query(`ALTER TABLE \`employeePosition\` DROP FOREIGN KEY \`FK_c3b098a7bdf65ed6daec420d23e\``);
await queryRunner.query(`ALTER TABLE \`employeePosition\` DROP FOREIGN KEY \`FK_1c8174b8e11333448f250657c49\``);
await queryRunner.query(`DROP TABLE \`employeePosMaster\``);
await queryRunner.query(`DROP TABLE \`employeePosition\``);
}
}

View file

@ -1,34 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableEmployeePosition11710330337194 implements MigrationInterface {
name = 'AddTableEmployeePosition11710330337194'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`employeePosLevel\` DROP FOREIGN KEY \`FK_a822851af7b58288be65debfdd5\``);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` DROP FOREIGN KEY \`FK_28d45cec912604b7d6f3dfac39a\``);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` DROP FOREIGN KEY \`FK_73ad56ef383399f567d58b213e2\``);
await queryRunner.query(`ALTER TABLE \`employeePosLevel\` CHANGE \`employeePosTypeId\` \`posTypeId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง employeePosType'`);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` DROP COLUMN \`employeePosTypeId\``);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` DROP COLUMN \`employeePosLevelId\``);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` ADD \`posTypeId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง employeePosType'`);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` ADD \`posLevelId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง employeePosLevel'`);
await queryRunner.query(`ALTER TABLE \`employeePosLevel\` ADD CONSTRAINT \`FK_7fb9ab868f3f46b44f460c984f1\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`employeePosType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` ADD CONSTRAINT \`FK_63e8a14abd222c948e0e175e941\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`employeePosType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` ADD CONSTRAINT \`FK_73da087c2ee4b6e74c9590ae3a2\` FOREIGN KEY (\`posLevelId\`) REFERENCES \`employeePosLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`employeePosDict\` DROP FOREIGN KEY \`FK_73da087c2ee4b6e74c9590ae3a2\``);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` DROP FOREIGN KEY \`FK_63e8a14abd222c948e0e175e941\``);
await queryRunner.query(`ALTER TABLE \`employeePosLevel\` DROP FOREIGN KEY \`FK_7fb9ab868f3f46b44f460c984f1\``);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` DROP COLUMN \`posLevelId\``);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` DROP COLUMN \`posTypeId\``);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` ADD \`employeePosLevelId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง employeePosLevel'`);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` ADD \`employeePosTypeId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง employeePosType'`);
await queryRunner.query(`ALTER TABLE \`employeePosLevel\` CHANGE \`posTypeId\` \`employeePosTypeId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง employeePosType'`);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` ADD CONSTRAINT \`FK_73ad56ef383399f567d58b213e2\` FOREIGN KEY (\`employeePosTypeId\`) REFERENCES \`employeePosType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosDict\` ADD CONSTRAINT \`FK_28d45cec912604b7d6f3dfac39a\` FOREIGN KEY (\`employeePosLevelId\`) REFERENCES \`employeePosLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosLevel\` ADD CONSTRAINT \`FK_a822851af7b58288be65debfdd5\` FOREIGN KEY (\`employeePosTypeId\`) REFERENCES \`employeePosType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}

View file

@ -1,14 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddColumnEmployeePosLevelPosLevelAuthority1710399617760 implements MigrationInterface {
name = 'AddColumnEmployeePosLevelPosLevelAuthority1710399617760'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`employeePosLevel\` ADD \`posLevelAuthority\` enum ('HEAD', 'DEPUTY', 'GOVERNOR') NULL COMMENT 'ผู้มีอำนาจสั่งบรรจุของระดับนี้ head = หัวหน้าหน่วยงาน , deputy = ปลัด , governor = ผู้ว่าฯ'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`employeePosLevel\` DROP COLUMN \`posLevelAuthority\``);
}
}

View file

@ -1,26 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableProfileEmployee1710487869374 implements MigrationInterface {
name = 'AddTableProfileEmployee1710487869374'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP FOREIGN KEY \`FK_00221b20fdf6d460a86f108fc6d\``);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP FOREIGN KEY \`FK_41945621a3f1e716dc3b2d994c3\``);
await queryRunner.query(`CREATE TABLE \`profileEmployee\` (\`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', \`prefix\` varchar(40) NULL COMMENT 'คำนำหน้าชื่อ', \`firstName\` varchar(255) NULL COMMENT 'ชื่อ', \`lastName\` varchar(255) NULL COMMENT 'นามสกุล', \`citizenId\` varchar(13) NULL COMMENT 'เลขประจำตัวประชาชน', \`position\` varchar(255) NULL COMMENT 'ตำแหน่ง', \`posLevelId\` varchar(40) NULL COMMENT 'ไอดีระดับตำแหน่ง', \`posTypeId\` varchar(40) NULL COMMENT 'ไอดีกลุ่มงานตำแหน่ง', \`email\` varchar(255) NULL COMMENT 'อีเมล', \`phone\` varchar(20) NULL COMMENT 'เบอร์โทร', \`keycloak\` varchar(40) NULL COMMENT 'id keycloak', \`isProbation\` tinyint NOT NULL COMMENT 'ทดลองปฏิบัติหน้าที่' DEFAULT 0, \`dateRetire\` datetime NULL COMMENT 'วันที่พักราชการ', \`birthDate\` datetime NULL COMMENT 'วันเกิด', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD CONSTRAINT \`FK_00221b20fdf6d460a86f108fc6d\` FOREIGN KEY (\`current_holderId\`) REFERENCES \`profileEmployee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD CONSTRAINT \`FK_41945621a3f1e716dc3b2d994c3\` FOREIGN KEY (\`next_holderId\`) REFERENCES \`profileEmployee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD CONSTRAINT \`FK_cc1b55a08a76d0d3e254c37e11e\` FOREIGN KEY (\`posLevelId\`) REFERENCES \`employeePosLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD CONSTRAINT \`FK_773469f2924994e83e9835c48f9\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`employeePosType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP FOREIGN KEY \`FK_773469f2924994e83e9835c48f9\``);
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP FOREIGN KEY \`FK_cc1b55a08a76d0d3e254c37e11e\``);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP FOREIGN KEY \`FK_41945621a3f1e716dc3b2d994c3\``);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP FOREIGN KEY \`FK_00221b20fdf6d460a86f108fc6d\``);
await queryRunner.query(`DROP TABLE \`profileEmployee\``);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD CONSTRAINT \`FK_41945621a3f1e716dc3b2d994c3\` FOREIGN KEY (\`next_holderId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD CONSTRAINT \`FK_00221b20fdf6d460a86f108fc6d\` FOREIGN KEY (\`current_holderId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}

View file

@ -1,52 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddProfiledevelopment1724689893914 implements MigrationInterface {
name = 'AddProfiledevelopment1724689893914'
public async up(queryRunner: QueryRunner): Promise<void> {
// await queryRunner.query(`CREATE TABLE \`subDistrictImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`DISTRICT_CODE\` varchar(255) NULL, \`DISTRICT_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`provinceImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`PROVINCE_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`developmentProject\` (\`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', \`name\` varchar(255) NULL COMMENT 'เทคนิควิธีการที่ใช้ในการพัฒนา', \`profileDevelopmentId\` varchar(255) NULL COMMENT 'โครงการ/หลักสูตรการฝึกอบรม', \`profileDevelopmentHistoryId\` varchar(255) NULL COMMENT 'โครงการ/หลักสูตรการฝึกอบรม', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileDevelopmentHistory\` (\`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', \`name\` varchar(255) NULL COMMENT 'ชื่อเรื่อง', \`target\` varchar(255) NULL COMMENT 'เป้าหมาย', \`summary\` double NULL COMMENT 'ผลการประเมิน', \`point\` int NULL COMMENT 'ระดับคะแนน', \`achievement10\` varchar(255) NULL COMMENT 'เกณฑ์การประเมิน 10', \`achievement5\` varchar(255) NULL COMMENT 'เกณฑ์การประเมิน 5', \`achievement0\` varchar(255) NULL COMMENT 'เกณฑ์การประเมิน 0', \`isDevelopment70\` tinyint NOT NULL COMMENT 'วิธีพัฒนา70' DEFAULT 0, \`isDevelopment20\` tinyint NOT NULL COMMENT 'วิธีพัฒนา20' DEFAULT 0, \`isDevelopment10\` tinyint NOT NULL COMMENT 'วิธีพัฒนา10' DEFAULT 0, \`reasonDevelopment70\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 70 แผน', \`reasonDevelopment20\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 20 แผน', \`reasonDevelopment10\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 10 แผน', \`profileDevelopmentId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`profileDevelopment\` (\`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', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', \`profileEmployeeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileEmployee', \`name\` varchar(255) NULL COMMENT 'ชื่อเรื่อง', \`target\` varchar(255) NULL COMMENT 'เป้าหมาย', \`summary\` double NULL COMMENT 'ผลการประเมิน', \`point\` int NULL COMMENT 'ระดับคะแนน', \`achievement10\` varchar(255) NULL COMMENT 'เกณฑ์การประเมิน 10', \`achievement5\` varchar(255) NULL COMMENT 'เกณฑ์การประเมิน 5', \`achievement0\` varchar(255) NULL COMMENT 'เกณฑ์การประเมิน 0', \`isDevelopment70\` tinyint NOT NULL COMMENT 'วิธีพัฒนา70' DEFAULT 0, \`isDevelopment20\` tinyint NOT NULL COMMENT 'วิธีพัฒนา20' DEFAULT 0, \`isDevelopment10\` tinyint NOT NULL COMMENT 'วิธีพัฒนา10' DEFAULT 0, \`reasonDevelopment70\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 70 แผน', \`reasonDevelopment20\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 20 แผน', \`reasonDevelopment10\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 10 แผน', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_POSITION_OFFICER\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`MP_POS_DATE\` text NULL, \`SALARY\` text NULL, \`MP_COMMAND_NUM\` text NULL, \`POS_NUM_NAME\` text NULL, \`POS_NUM_CODE\` text NULL, \`FLAG_TO_NAME\` text NULL, \`WORK_LINE_NAME\` text NULL, \`SPECIALIST_NAME\` text NULL, \`ADMIN_NAME\` text NULL, \`REMARK\` text NULL, \`ORDER_MOVE_POSITION\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION_EMP\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`educationMis\` (\`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', \`EDUCATION_CODE\` varchar(255) NULL, \`EDUCATION_NAME\` varchar(255) NULL, \`EDUCATION_ABB_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`amphurImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`AMPHUR_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` CHANGE \`attrPrivilege\` \`attrPrivilege\` varchar(255) NULL COMMENT 'สิทธิ์การเข้าถึง(Privilege)'`);
await queryRunner.query(`ALTER TABLE \`developmentProject\` ADD CONSTRAINT \`FK_4913ef1466f9f35c1429e213d4b\` FOREIGN KEY (\`profileDevelopmentId\`) REFERENCES \`profileDevelopment\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`developmentProject\` ADD CONSTRAINT \`FK_8e3f2e86427befeff4283ae80f0\` FOREIGN KEY (\`profileDevelopmentHistoryId\`) REFERENCES \`profileDevelopmentHistory\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` ADD CONSTRAINT \`FK_9fbaa3ecee59ad3234dc54d1ffc\` FOREIGN KEY (\`profileDevelopmentId\`) REFERENCES \`profileDevelopment\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` ADD CONSTRAINT \`FK_072762f69ecb89f5c888d29187e\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` ADD CONSTRAINT \`FK_25fcdd2e5cd0b8d2a7c27c015d0\` FOREIGN KEY (\`profileEmployeeId\`) REFERENCES \`profileEmployee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` DROP FOREIGN KEY \`FK_25fcdd2e5cd0b8d2a7c27c015d0\``);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` DROP FOREIGN KEY \`FK_072762f69ecb89f5c888d29187e\``);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` DROP FOREIGN KEY \`FK_9fbaa3ecee59ad3234dc54d1ffc\``);
await queryRunner.query(`ALTER TABLE \`developmentProject\` DROP FOREIGN KEY \`FK_8e3f2e86427befeff4283ae80f0\``);
await queryRunner.query(`ALTER TABLE \`developmentProject\` DROP FOREIGN KEY \`FK_4913ef1466f9f35c1429e213d4b\``);
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` CHANGE \`attrPrivilege\` \`attrPrivilege\` varchar(255) NULL COMMENT 'สิทธิการเข้าถึง(Privilege)'`);
// await queryRunner.query(`DROP TABLE \`amphurImport\``);
// await queryRunner.query(`DROP TABLE \`educationMis\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION_EMP\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_FAMILY\``);
// await queryRunner.query(`DROP TABLE \`HR_POSITION_OFFICER\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_FAMILY\``);
await queryRunner.query(`DROP TABLE \`profileDevelopment\``);
await queryRunner.query(`DROP TABLE \`profileDevelopmentHistory\``);
await queryRunner.query(`DROP TABLE \`developmentProject\``);
// await queryRunner.query(`DROP TABLE \`provinceImport\``);
// await queryRunner.query(`DROP TABLE \`subDistrictImport\``);
}
}

View file

@ -1,42 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddProfiledevelopment11724754372183 implements MigrationInterface {
name = 'AddProfiledevelopment11724754372183'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`developmentProject\` DROP FOREIGN KEY \`FK_4913ef1466f9f35c1429e213d4b\``);
await queryRunner.query(`ALTER TABLE \`developmentProject\` DROP FOREIGN KEY \`FK_8e3f2e86427befeff4283ae80f0\``);
// await queryRunner.query(`CREATE TABLE \`subDistrictImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`DISTRICT_CODE\` varchar(255) NULL, \`DISTRICT_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`provinceImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`PROVINCE_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_POSITION_OFFICER\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`MP_POS_DATE\` text NULL, \`SALARY\` text NULL, \`MP_COMMAND_NUM\` text NULL, \`POS_NUM_NAME\` text NULL, \`POS_NUM_CODE\` text NULL, \`FLAG_TO_NAME\` text NULL, \`WORK_LINE_NAME\` text NULL, \`SPECIALIST_NAME\` text NULL, \`ADMIN_NAME\` text NULL, \`REMARK\` text NULL, \`ORDER_MOVE_POSITION\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION_EMP\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`educationMis\` (\`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', \`EDUCATION_CODE\` varchar(255) NULL, \`EDUCATION_NAME\` varchar(255) NULL, \`EDUCATION_ABB_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`amphurImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`AMPHUR_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` ADD \`kpiDevelopmentId\` varchar(40) NULL COMMENT 'id kpi development'`);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` ADD \`kpiDevelopmentId\` varchar(40) NULL COMMENT 'id kpi development'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` DROP COLUMN \`kpiDevelopmentId\``);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` DROP COLUMN \`kpiDevelopmentId\``);
// await queryRunner.query(`DROP TABLE \`amphurImport\``);
// await queryRunner.query(`DROP TABLE \`educationMis\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION_EMP\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_FAMILY\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`HR_POSITION_OFFICER\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_FAMILY\``);
// await queryRunner.query(`DROP TABLE \`provinceImport\``);
// await queryRunner.query(`DROP TABLE \`subDistrictImport\``);
await queryRunner.query(`ALTER TABLE \`developmentProject\` ADD CONSTRAINT \`FK_8e3f2e86427befeff4283ae80f0\` FOREIGN KEY (\`profileDevelopmentHistoryId\`) REFERENCES \`profileDevelopmentHistory\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`developmentProject\` ADD CONSTRAINT \`FK_4913ef1466f9f35c1429e213d4b\` FOREIGN KEY (\`profileDevelopmentId\`) REFERENCES \`profileDevelopment\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}

View file

@ -1,40 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddPermissionOrg1725589283549 implements MigrationInterface {
name = 'AddPermissionOrg1725589283549'
public async up(queryRunner: QueryRunner): Promise<void> {
// await queryRunner.query(`CREATE TABLE \`subDistrictImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`DISTRICT_CODE\` varchar(255) NULL, \`DISTRICT_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`permissionOrg\` (\`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', \`orgRootId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง orgRoot', \`profileId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง profile', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`provinceImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`PROVINCE_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_POSITION_OFFICER\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`MP_POS_DATE\` text NULL, \`SALARY\` text NULL, \`MP_COMMAND_NUM\` text NULL, \`POS_NUM_NAME\` text NULL, \`POS_NUM_CODE\` text NULL, \`FLAG_TO_NAME\` text NULL, \`WORK_LINE_NAME\` text NULL, \`SPECIALIST_NAME\` text NULL, \`ADMIN_NAME\` text NULL, \`REMARK\` text NULL, \`ORDER_MOVE_POSITION\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION_EMP\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`educationMis\` (\`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', \`EDUCATION_CODE\` varchar(255) NULL, \`EDUCATION_NAME\` varchar(255) NULL, \`EDUCATION_ABB_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`amphurImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`AMPHUR_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`permissionOrg\` ADD CONSTRAINT \`FK_471dc0db0e9ee18a6281cdab5fd\` FOREIGN KEY (\`orgRootId\`) REFERENCES \`orgRoot\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`permissionOrg\` ADD CONSTRAINT \`FK_45c52b4fd930e641c6bcfb3e0b2\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`permissionOrg\` DROP FOREIGN KEY \`FK_45c52b4fd930e641c6bcfb3e0b2\``);
await queryRunner.query(`ALTER TABLE \`permissionOrg\` DROP FOREIGN KEY \`FK_471dc0db0e9ee18a6281cdab5fd\``);
// await queryRunner.query(`DROP TABLE \`amphurImport\``);
// await queryRunner.query(`DROP TABLE \`educationMis\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION_EMP\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_FAMILY\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`HR_POSITION_OFFICER\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_FAMILY\``);
// await queryRunner.query(`DROP TABLE \`provinceImport\``);
// await queryRunner.query(`DROP TABLE \`permissionOrg\``);
// await queryRunner.query(`DROP TABLE \`subDistrictImport\``);
}
}

View file

@ -1,40 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddCommand1726046987224 implements MigrationInterface {
name = 'AddCommand1726046987224'
public async up(queryRunner: QueryRunner): Promise<void> {
// await queryRunner.query(`CREATE TABLE \`subDistrictImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`DISTRICT_CODE\` varchar(255) NULL, \`DISTRICT_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`provinceImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`PROVINCE_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_POSITION_OFFICER\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`MP_POS_DATE\` text NULL, \`SALARY\` text NULL, \`MP_COMMAND_NUM\` text NULL, \`POS_NUM_NAME\` text NULL, \`POS_NUM_CODE\` text NULL, \`FLAG_TO_NAME\` text NULL, \`WORK_LINE_NAME\` text NULL, \`SPECIALIST_NAME\` text NULL, \`ADMIN_NAME\` text NULL, \`REMARK\` text NULL, \`ORDER_MOVE_POSITION\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION_EMP\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`educationMis\` (\`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', \`EDUCATION_CODE\` varchar(255) NULL, \`EDUCATION_NAME\` varchar(255) NULL, \`EDUCATION_ABB_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`commandType\` (\`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', \`name\` varchar(255) NULL COMMENT 'ชื่อคำสั่ง', \`type\` varchar(255) NULL COMMENT 'ประเภทคำสั่ง', \`code\` varchar(255) NULL COMMENT 'รหัสคำสั่ง', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`command\` (\`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', \`status\` varchar(20) NULL COMMENT 'สถานะ', \`issue\` varchar(255) NULL COMMENT 'คำสั่งเรื่อง', \`commandNo\` varchar(255) NULL COMMENT 'เลขที่คำสั่ง', \`commandYear\` int NULL COMMENT 'ปี', \`commandAffectDate\` datetime NULL COMMENT 'วันที่ลงนาม', \`commandExcecuteDate\` datetime NULL COMMENT 'วันที่คำสั่งมีผล', \`detailHeader\` text NULL COMMENT 'เนื้อหาคำสั่งส่วนต้น', \`detailBody\` text NULL COMMENT 'เนื้อหาคำสั่งส่วนกลาง', \`detailFooter\` text NULL COMMENT 'เนื้อหาคำสั่งส่วนท้าย', \`commandTypeId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง commandType', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`amphurImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`AMPHUR_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`command\` ADD CONSTRAINT \`FK_c14ab4000e0fc4f43e066c3f5fd\` FOREIGN KEY (\`commandTypeId\`) REFERENCES \`commandType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`command\` DROP FOREIGN KEY \`FK_c14ab4000e0fc4f43e066c3f5fd\``);
// await queryRunner.query(`DROP TABLE \`amphurImport\``);
await queryRunner.query(`DROP TABLE \`command\``);
await queryRunner.query(`DROP TABLE \`commandType\``);
// await queryRunner.query(`DROP TABLE \`educationMis\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION_EMP\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_FAMILY\``);
// await queryRunner.query(`DROP TABLE \`HR_POSITION_OFFICER\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_FAMILY\``);
// await queryRunner.query(`DROP TABLE \`provinceImport\``);
// await queryRunner.query(`DROP TABLE \`subDistrictImport\``);
}
}

View file

@ -1,42 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddCommandType1726052018309 implements MigrationInterface {
name = 'AddCommandType1726052018309'
public async up(queryRunner: QueryRunner): Promise<void> {
// await queryRunner.query(`CREATE TABLE \`subDistrictImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`DISTRICT_CODE\` varchar(255) NULL, \`DISTRICT_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`provinceImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`PROVINCE_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_POSITION_OFFICER\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`MP_POS_DATE\` text NULL, \`SALARY\` text NULL, \`MP_COMMAND_NUM\` text NULL, \`POS_NUM_NAME\` text NULL, \`POS_NUM_CODE\` text NULL, \`FLAG_TO_NAME\` text NULL, \`WORK_LINE_NAME\` text NULL, \`SPECIALIST_NAME\` text NULL, \`ADMIN_NAME\` text NULL, \`REMARK\` text NULL, \`ORDER_MOVE_POSITION\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION_EMP\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`educationMis\` (\`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', \`EDUCATION_CODE\` varchar(255) NULL, \`EDUCATION_NAME\` varchar(255) NULL, \`EDUCATION_ABB_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`amphurImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`AMPHUR_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`detailHeader\` text NULL COMMENT 'เนื้อหาคำสั่งส่วนต้น'`);
await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`detailBody\` text NULL COMMENT 'เนื้อหาคำสั่งส่วนกลาง'`);
await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`detailFooter\` text NULL COMMENT 'เนื้อหาคำสั่งส่วนท้าย'`);
await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 1`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`isActive\``);
await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`detailFooter\``);
await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`detailBody\``);
await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`detailHeader\``);
// await queryRunner.query(`DROP TABLE \`amphurImport\``);
// await queryRunner.query(`DROP TABLE \`educationMis\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION_EMP\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_FAMILY\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_FAMILY\``);
// await queryRunner.query(`DROP TABLE \`HR_POSITION_OFFICER\``);
// await queryRunner.query(`DROP TABLE \`provinceImport\``);
// await queryRunner.query(`DROP TABLE \`subDistrictImport\``);
}
}

View file

@ -1,44 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddCommandSys1726136471842 implements MigrationInterface {
name = 'AddCommandSys1726136471842'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandType\` CHANGE \`type\` \`commandSysId\` varchar(255) NULL COMMENT 'ประเภทคำสั่ง'`);
// await queryRunner.query(`CREATE TABLE \`subDistrictImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`DISTRICT_CODE\` varchar(255) NULL, \`DISTRICT_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`provinceImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`PROVINCE_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_POSITION_OFFICER\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`MP_POS_DATE\` text NULL, \`SALARY\` text NULL, \`MP_COMMAND_NUM\` text NULL, \`POS_NUM_NAME\` text NULL, \`POS_NUM_CODE\` text NULL, \`FLAG_TO_NAME\` text NULL, \`WORK_LINE_NAME\` text NULL, \`SPECIALIST_NAME\` text NULL, \`ADMIN_NAME\` text NULL, \`REMARK\` text NULL, \`ORDER_MOVE_POSITION\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION_EMP\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`educationMis\` (\`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', \`EDUCATION_CODE\` varchar(255) NULL, \`EDUCATION_NAME\` varchar(255) NULL, \`EDUCATION_ABB_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`commandSys\` (\`id\` varchar(255) NOT NULL COMMENT 'ไอดีหลักของตาราง', \`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', \`sysName\` varchar(255) NULL COMMENT 'ชื่อระบบ', \`sysDescription\` varchar(255) NULL COMMENT 'รายละเอียด', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`amphurImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`AMPHUR_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`commandSysId\``);
await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`commandSysId\` varchar(255) NULL COMMENT 'คีย์นอก(FK)ของตาราง CommandSys'`);
await queryRunner.query(`ALTER TABLE \`commandType\` ADD CONSTRAINT \`FK_f88b8f74716e19276348bad75ef\` FOREIGN KEY (\`commandSysId\`) REFERENCES \`commandSys\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandType\` DROP FOREIGN KEY \`FK_f88b8f74716e19276348bad75ef\``);
await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`commandSysId\``);
await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`commandSysId\` varchar(255) NULL COMMENT 'ประเภทคำสั่ง'`);
// await queryRunner.query(`DROP TABLE \`amphurImport\``);
await queryRunner.query(`DROP TABLE \`commandSys\``);
// await queryRunner.query(`DROP TABLE \`educationMis\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION_EMP\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_FAMILY\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_FAMILY\``);
// await queryRunner.query(`DROP TABLE \`HR_POSITION_OFFICER\``);
// await queryRunner.query(`DROP TABLE \`provinceImport\``);
// await queryRunner.query(`DROP TABLE \`subDistrictImport\``);
await queryRunner.query(`ALTER TABLE \`commandType\` CHANGE \`commandSysId\` \`type\` varchar(255) NULL COMMENT 'ประเภทคำสั่ง'`);
}
}

View file

@ -1,42 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddIsDirector1726149698735 implements MigrationInterface {
name = 'AddIsDirector1726149698735'
public async up(queryRunner: QueryRunner): Promise<void> {
// await queryRunner.query(`CREATE TABLE \`subDistrictImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`DISTRICT_CODE\` varchar(255) NULL, \`DISTRICT_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`provinceImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`PROVINCE_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_POSITION_OFFICER\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`MP_POS_DATE\` text NULL, \`SALARY\` text NULL, \`MP_COMMAND_NUM\` text NULL, \`POS_NUM_NAME\` text NULL, \`POS_NUM_CODE\` text NULL, \`FLAG_TO_NAME\` text NULL, \`WORK_LINE_NAME\` text NULL, \`SPECIALIST_NAME\` text NULL, \`ADMIN_NAME\` text NULL, \`REMARK\` text NULL, \`ORDER_MOVE_POSITION\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION_EMP\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`educationMis\` (\`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', \`EDUCATION_CODE\` varchar(255) NULL, \`EDUCATION_NAME\` varchar(255) NULL, \`EDUCATION_ABB_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`amphurImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`AMPHUR_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD \`isStaff\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD \`positionSign\` text NULL COMMENT 'ตำแหน่งใต้ลายเซ็นต์'`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`isStaff\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`positionSign\` text NULL COMMENT 'ตำแหน่งใต้ลายเซ็นต์'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`positionSign\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`isStaff\``);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP COLUMN \`positionSign\``);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP COLUMN \`isStaff\``);
// await queryRunner.query(`DROP TABLE \`amphurImport\``);
// await queryRunner.query(`DROP TABLE \`educationMis\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION_EMP\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_FAMILY\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_FAMILY\``);
// await queryRunner.query(`DROP TABLE \`HR_POSITION_OFFICER\``);
// await queryRunner.query(`DROP TABLE \`provinceImport\``);
// await queryRunner.query(`DROP TABLE \`subDistrictImport\``);
}
}

View file

@ -1,48 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddCommandSend1726154911194 implements MigrationInterface {
name = 'AddCommandSend1726154911194'
public async up(queryRunner: QueryRunner): Promise<void> {
// await queryRunner.query(`CREATE TABLE \`subDistrictImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`DISTRICT_CODE\` varchar(255) NULL, \`DISTRICT_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`commandSend\` (\`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', \`sendCC\` varchar(20) NULL COMMENT 'ช่องทางการส่งสำเนา', \`citizenId\` varchar(255) NULL COMMENT 'เลขประจำตัวประชาชน', \`prefix\` varchar(255) NULL COMMENT 'คำนำหน้า', \`fristName\` varchar(255) NULL COMMENT 'ชื่อ', \`lastName\` varchar(255) NULL COMMENT 'สกุล', \`position\` varchar(255) NULL COMMENT 'ตำแหน่ง', \`org\` varchar(255) NULL COMMENT 'หน่วยงาน', \`commandId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง command', \`profileId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง profile', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`provinceImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`PROVINCE_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_POSITION_OFFICER\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`MP_POS_DATE\` text NULL, \`SALARY\` text NULL, \`MP_COMMAND_NUM\` text NULL, \`POS_NUM_NAME\` text NULL, \`POS_NUM_CODE\` text NULL, \`FLAG_TO_NAME\` text NULL, \`WORK_LINE_NAME\` text NULL, \`SPECIALIST_NAME\` text NULL, \`ADMIN_NAME\` text NULL, \`REMARK\` text NULL, \`ORDER_MOVE_POSITION\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`educationMis\` (\`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', \`EDUCATION_CODE\` varchar(255) NULL, \`EDUCATION_NAME\` varchar(255) NULL, \`EDUCATION_ABB_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION_EMP\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`amphurImport\` (\`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', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`AMPHUR_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`ALTER TABLE \`employeePosMaster\` CHANGE \`isStaff\` \`isStaff\` tinyint NOT NULL COMMENT 'เป็นเจ้าหน้าที่' DEFAULT 0`);
// await queryRunner.query(`ALTER TABLE \`employeePosMaster\` CHANGE \`isOfficer\` \`isOfficer\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT 0`);
// await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`isStaff\` \`isStaff\` tinyint NOT NULL COMMENT 'เป็นเจ้าหน้าที่' DEFAULT 0`);
// await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`isOfficer\` \`isOfficer\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`commandSend\` ADD CONSTRAINT \`FK_71884cff2519003c997c4129374\` FOREIGN KEY (\`commandId\`) REFERENCES \`command\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`commandSend\` ADD CONSTRAINT \`FK_4f257ba4ce200ddc0726156a00d\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandSend\` DROP FOREIGN KEY \`FK_4f257ba4ce200ddc0726156a00d\``);
await queryRunner.query(`ALTER TABLE \`commandSend\` DROP FOREIGN KEY \`FK_71884cff2519003c997c4129374\``);
// await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`isOfficer\` \`isOfficer\` tinyint NOT NULL COMMENT 'เป็นเจ้าหน้าที่' DEFAULT '0'`);
// await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`isStaff\` \`isStaff\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT '0'`);
// await queryRunner.query(`ALTER TABLE \`employeePosMaster\` CHANGE \`isOfficer\` \`isOfficer\` tinyint NOT NULL COMMENT 'เป็นเจ้าหน้าที่' DEFAULT '0'`);
// await queryRunner.query(`ALTER TABLE \`employeePosMaster\` CHANGE \`isStaff\` \`isStaff\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT '0'`);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_FAMILY\``);
// await queryRunner.query(`DROP TABLE \`amphurImport\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION_EMP\``);
// await queryRunner.query(`DROP TABLE \`educationMis\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`HR_POSITION_OFFICER\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_FAMILY\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`provinceImport\``);
await queryRunner.query(`DROP TABLE \`commandSend\``);
// await queryRunner.query(`DROP TABLE \`subDistrictImport\``);
}
}

View file

@ -1,18 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateChild1AddIsOfficer1726209768514 implements MigrationInterface {
name = 'UpdateChild1AddIsOfficer1726209768514'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP COLUMN \`isOfficer\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`isOfficer\``);
await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD \`isOfficer\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT 0`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP COLUMN \`isOfficer\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`isOfficer\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD \`isOfficer\` tinyint NOT NULL COMMENT 'เป็นสกจ' DEFAULT '0'`);
}
}

View file

@ -1,18 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateChild1AddIsOfficer11726215497371 implements MigrationInterface {
name = 'UpdateChild1AddIsOfficer11726215497371'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`commandSendCC\` (\`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', \`name\` varchar(255) NULL COMMENT 'เพศ', \`commandSendId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง commandSend', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`commandSend\` DROP COLUMN \`sendCC\``);
await queryRunner.query(`ALTER TABLE \`commandSendCC\` ADD CONSTRAINT \`FK_52f7c9e67d813ba4f8c213f436c\` FOREIGN KEY (\`commandSendId\`) REFERENCES \`commandSend\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandSendCC\` DROP FOREIGN KEY \`FK_52f7c9e67d813ba4f8c213f436c\``);
await queryRunner.query(`ALTER TABLE \`commandSend\` ADD \`sendCC\` varchar(20) NULL COMMENT 'ช่องทางการส่งสำเนา'`);
await queryRunner.query(`DROP TABLE \`commandSendCC\``);
}
}

View file

@ -1,16 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddCommandSalary1726455828396 implements MigrationInterface {
name = 'AddCommandSalary1726455828396'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`commandSalary\` (\`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', \`name\` varchar(255) NULL COMMENT 'ชื่อคำสั่ง', \`isActive\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 1, \`commandSysId\` varchar(255) NULL COMMENT 'คีย์นอก(FK)ของตาราง CommandSys', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`commandSalary\` ADD CONSTRAINT \`FK_52519043506061e558b992ba0dd\` FOREIGN KEY (\`commandSysId\`) REFERENCES \`commandSys\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandSalary\` DROP FOREIGN KEY \`FK_52519043506061e558b992ba0dd\``);
await queryRunner.query(`DROP TABLE \`commandSalary\``);
}
}

View file

@ -1,18 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddCommandSalary1726474393379 implements MigrationInterface {
name = 'AddCommandSalary1726474393379'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`fileCover\` varchar(255) NULL COMMENT 'คำสั่งเรื่อง'`);
await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`fileAttachment\` varchar(255) NULL COMMENT 'คำสั่งเรื่อง'`);
// await queryRunner.query(`ALTER TABLE \`HR_POSITION_OFFICER\` ADD \`FLAG_PERSON_TYPE\` text NULL`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
// await queryRunner.query(`ALTER TABLE \`HR_POSITION_OFFICER\` DROP COLUMN \`FLAG_PERSON_TYPE\``);
await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`fileAttachment\``);
await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`fileCover\``);
}
}

View file

@ -1,16 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateCommandTypeAddOrder1726479252659 implements MigrationInterface {
name = 'UpdateCommandTypeAddOrder1726479252659'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`order\` int NULL COMMENT 'ลำดับความสำคัญ'`);
// await queryRunner.query(`ALTER TABLE \`HR_POSITION_OFFICER\` ADD \`FLAG_PERSON_TYPE\` text NULL`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
// await queryRunner.query(`ALTER TABLE \`HR_POSITION_OFFICER\` DROP COLUMN \`FLAG_PERSON_TYPE\``);
await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`order\``);
}
}

View file

@ -1,18 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateCommandTypeAddIsAttachment1726736124344 implements MigrationInterface {
name = 'UpdateCommandTypeAddIsAttachment1726736124344'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`isAttachment\` tinyint NOT NULL COMMENT 'สถานะบัญชีแนบท้าย' DEFAULT 1`);
await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`subtitle\` text NULL COMMENT 'คำอธิบาย'`);
// await queryRunner.query(`ALTER TABLE \`HR_POSITION_OFFICER\` ADD \`FLAG_PERSON_TYPE\` text NULL`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
// await queryRunner.query(`ALTER TABLE \`HR_POSITION_OFFICER\` DROP COLUMN \`FLAG_PERSON_TYPE\``);
await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`subtitle\``);
await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`isAttachment\``);
}
}

View file

@ -1,18 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateCommandAddIsAttachment1727081490162 implements MigrationInterface {
name = 'UpdateCommandAddIsAttachment1727081490162'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandSys\` ADD \`order\` int NULL COMMENT 'ลำดับแสดงผล'`);
await queryRunner.query(`ALTER TABLE \`command\` ADD \`isAttachment\` tinyint NOT NULL COMMENT 'สถานะบัญชีแนบท้าย' DEFAULT 1`);
await queryRunner.query(`ALTER TABLE \`HR_POSITION_OFFICER\` ADD \`FLAG_PERSON_TYPE\` text NULL`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`HR_POSITION_OFFICER\` DROP COLUMN \`FLAG_PERSON_TYPE\``);
await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`isAttachment\``);
await queryRunner.query(`ALTER TABLE \`commandSys\` DROP COLUMN \`order\``);
}
}

View file

@ -1,18 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateCommandAddIsSign1727151717676 implements MigrationInterface {
name = 'UpdateCommandAddIsSign1727151717676'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`command\` ADD \`isSignature\` tinyint NULL COMMENT 'ออกคำสั่งแบบ Digital Signature'`);
await queryRunner.query(`ALTER TABLE \`command\` ADD \`isDraft\` tinyint NOT NULL COMMENT 'ยืนยันทำแบบร่าง' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`command\` ADD \`isSign\` tinyint NOT NULL COMMENT 'ผู้มีอำนาจลงนาม' DEFAULT 0`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`isSign\``);
await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`isDraft\``);
await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`isSignature\``);
}
}

View file

@ -1,24 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateCommandAddPositiondetail1727167169710 implements MigrationInterface {
name = 'UpdateCommandAddPositiondetail1727167169710'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`commandRecive\` (\`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', \`citizenId\` varchar(255) NULL COMMENT 'เลขประจำตัวประชาชน', \`prefix\` varchar(255) NULL COMMENT 'คำนำหน้า', \`fristName\` varchar(255) NULL COMMENT 'ชื่อ', \`lastName\` varchar(255) NULL COMMENT 'สกุล', \`position\` varchar(255) NULL COMMENT 'ตำแหน่ง', \`org\` varchar(255) NULL COMMENT 'หน่วยงาน', \`commandId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง command', \`profileId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง profile', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`command\` ADD \`positionDetail\` text NULL COMMENT 'ตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`command\` ADD \`commandSalaryId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง commandSalary'`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD CONSTRAINT \`FK_66de028b0d8e4cff62bc43a58be\` FOREIGN KEY (\`commandId\`) REFERENCES \`command\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD CONSTRAINT \`FK_fb29bfd315d0d43d0b49b362995\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`command\` ADD CONSTRAINT \`FK_c85f006fc84cebf07b0980c6b94\` FOREIGN KEY (\`commandSalaryId\`) REFERENCES \`commandSalary\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`command\` DROP FOREIGN KEY \`FK_c85f006fc84cebf07b0980c6b94\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP FOREIGN KEY \`FK_fb29bfd315d0d43d0b49b362995\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP FOREIGN KEY \`FK_66de028b0d8e4cff62bc43a58be\``);
await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`commandSalaryId\``);
await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`positionDetail\``);
await queryRunner.query(`DROP TABLE \`commandRecive\``);
}
}

View file

@ -1,24 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateCommandReciveAddSalary1727246671059 implements MigrationInterface {
name = 'UpdateCommandReciveAddSalary1727246671059'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`order\` int NULL COMMENT 'ลำดับแสดงผล'`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`remarkVertical\` text NULL COMMENT 'หมายเหตุแนวตั้ง'`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`remarkHorizontal\` text NULL COMMENT 'หมายเหตุแนวนอน'`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`amount\` double NULL COMMENT 'เงินเดือนฐาน' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`positionSalaryAmount\` double NULL COMMENT 'เงินประจำตำแหน่ง' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`mouthSalaryAmount\` double NULL COMMENT 'เงินค่าตอบแทนรายเดือน' DEFAULT '0'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`mouthSalaryAmount\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`positionSalaryAmount\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`amount\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`remarkHorizontal\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`remarkVertical\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`order\``);
}
}

View file

@ -1,24 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateCommandReciveAddSalary11727260590227 implements MigrationInterface {
name = 'UpdateCommandReciveAddSalary11727260590227'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandRecive\` CHANGE \`fristName\` \`firstName\` varchar(255) NULL COMMENT 'ชื่อ'`);
await queryRunner.query(`ALTER TABLE \`commandSend\` CHANGE \`fristName\` \`firstName\` varchar(255) NULL COMMENT 'ชื่อ'`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`firstName\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`firstName\` varchar(255) NULL COMMENT 'ชื่อ'`);
await queryRunner.query(`ALTER TABLE \`commandSend\` DROP COLUMN \`firstName\``);
await queryRunner.query(`ALTER TABLE \`commandSend\` ADD \`firstName\` varchar(255) NULL COMMENT 'ชื่อ'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandSend\` DROP COLUMN \`firstName\``);
await queryRunner.query(`ALTER TABLE \`commandSend\` ADD \`firstName\` varchar(255) NULL COMMENT 'ชื่อ'`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`firstName\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`firstName\` varchar(255) NULL COMMENT 'ชื่อ'`);
await queryRunner.query(`ALTER TABLE \`commandSend\` CHANGE \`firstName\` \`fristName\` varchar(255) NULL COMMENT 'ชื่อ'`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` CHANGE \`firstName\` \`fristName\` varchar(255) NULL COMMENT 'ชื่อ'`);
}
}

View file

@ -1,14 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateCommandReciveAddIsbangkok1727272904603 implements MigrationInterface {
name = 'UpdateCommandReciveAddIsbangkok1727272904603'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`command\` ADD \`isBangkok\` tinyint NULL COMMENT 'คำสั่งกรุงเทพมหานคร'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`isBangkok\``);
}
}

View file

@ -1,42 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableDevelopmentRequest1727689358961 implements MigrationInterface {
name = 'AddTableDevelopmentRequest1727689358961'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`developmentRequest\` (\`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', \`status\` varchar(255) NULL COMMENT 'สถานะ', \`reason\` varchar(255) NULL COMMENT 'หมายเหตุ', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', \`profileEmployeeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileEmployee', \`name\` varchar(255) NULL COMMENT 'ชื่อเรื่อง', \`isDevelopment70\` tinyint NOT NULL COMMENT 'วิธีพัฒนา70' DEFAULT 0, \`isDevelopment20\` tinyint NOT NULL COMMENT 'วิธีพัฒนา20' DEFAULT 0, \`isDevelopment10\` tinyint NOT NULL COMMENT 'วิธีพัฒนา10' DEFAULT 0, \`reasonDevelopment70\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 70 แผน', \`reasonDevelopment20\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 20 แผน', \`reasonDevelopment10\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 10 แผน', \`developmentTarget\` varchar(255) NULL COMMENT 'เป้าหมายการนำไปพัฒนางาน', \`developmentResults\` varchar(255) NULL COMMENT 'วิธีการวัดผลการพัฒนา', \`developmentReport\` varchar(255) NULL COMMENT 'รายงานผลการพัฒนา', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`developmentProject\` ADD \`developmentRequestId\` varchar(255) NULL COMMENT 'โครงการ/หลักสูตรการฝึกอบรม'`);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` ADD \`type\` varchar(255) NULL COMMENT 'ระบบ'`);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` ADD \`developmentTarget\` varchar(255) NULL COMMENT 'เป้าหมายการนำไปพัฒนางาน'`);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` ADD \`developmentResults\` varchar(255) NULL COMMENT 'วิธีการวัดผลการพัฒนา'`);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` ADD \`developmentReport\` varchar(255) NULL COMMENT 'รายงานผลการพัฒนา'`);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` ADD \`type\` varchar(255) NULL COMMENT 'ระบบ'`);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` ADD \`developmentTarget\` varchar(255) NULL COMMENT 'เป้าหมายการนำไปพัฒนางาน'`);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` ADD \`developmentResults\` varchar(255) NULL COMMENT 'วิธีการวัดผลการพัฒนา'`);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` ADD \`developmentReport\` varchar(255) NULL COMMENT 'รายงานผลการพัฒนา'`);
await queryRunner.query(`ALTER TABLE \`developmentRequest\` ADD CONSTRAINT \`FK_0dd78a592b78ee0db5b2c8386d2\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`developmentRequest\` ADD CONSTRAINT \`FK_0c08cab1ebc7e022cad0c6a7556\` FOREIGN KEY (\`profileEmployeeId\`) REFERENCES \`profileEmployee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`developmentProject\` ADD CONSTRAINT \`FK_4913ef1466f9f35c1429e213d4b\` FOREIGN KEY (\`profileDevelopmentId\`) REFERENCES \`profileDevelopment\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`developmentProject\` ADD CONSTRAINT \`FK_8e3f2e86427befeff4283ae80f0\` FOREIGN KEY (\`profileDevelopmentHistoryId\`) REFERENCES \`profileDevelopmentHistory\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`developmentProject\` ADD CONSTRAINT \`FK_e2819f1edc526aa71ac127418fa\` FOREIGN KEY (\`developmentRequestId\`) REFERENCES \`developmentRequest\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`developmentProject\` DROP FOREIGN KEY \`FK_e2819f1edc526aa71ac127418fa\``);
await queryRunner.query(`ALTER TABLE \`developmentProject\` DROP FOREIGN KEY \`FK_8e3f2e86427befeff4283ae80f0\``);
await queryRunner.query(`ALTER TABLE \`developmentProject\` DROP FOREIGN KEY \`FK_4913ef1466f9f35c1429e213d4b\``);
await queryRunner.query(`ALTER TABLE \`developmentRequest\` DROP FOREIGN KEY \`FK_0c08cab1ebc7e022cad0c6a7556\``);
await queryRunner.query(`ALTER TABLE \`developmentRequest\` DROP FOREIGN KEY \`FK_0dd78a592b78ee0db5b2c8386d2\``);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` DROP COLUMN \`developmentReport\``);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` DROP COLUMN \`developmentResults\``);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` DROP COLUMN \`developmentTarget\``);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` DROP COLUMN \`type\``);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` DROP COLUMN \`developmentReport\``);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` DROP COLUMN \`developmentResults\``);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` DROP COLUMN \`developmentTarget\``);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` DROP COLUMN \`type\``);
await queryRunner.query(`ALTER TABLE \`developmentProject\` DROP COLUMN \`developmentRequestId\``);
await queryRunner.query(`DROP TABLE \`developmentRequest\``);
}
}

View file

@ -1,24 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateProfileDevelopment1727752118300 implements MigrationInterface {
name = 'UpdateProfileDevelopment1727752118300'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` DROP COLUMN \`point\``);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` DROP COLUMN \`summary\``);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` DROP COLUMN \`target\``);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` DROP COLUMN \`point\``);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` DROP COLUMN \`summary\``);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` DROP COLUMN \`target\``);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` ADD \`target\` varchar(255) NULL COMMENT 'เป้าหมาย'`);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` ADD \`summary\` double NULL COMMENT 'ผลการประเมิน'`);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` ADD \`point\` int NULL COMMENT 'ระดับคะแนน'`);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` ADD \`target\` varchar(255) NULL COMMENT 'เป้าหมาย'`);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` ADD \`summary\` double NULL COMMENT 'ผลการประเมิน'`);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` ADD \`point\` int NULL COMMENT 'ระดับคะแนน'`);
}
}

View file

@ -1,22 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateProfileDevelopment11727795520589 implements MigrationInterface {
name = 'UpdateProfileDevelopment11727795520589'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP FOREIGN KEY \`FK_fb29bfd315d0d43d0b49b362995\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`org\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`position\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`profileId\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`refId\` varchar(40) NULL COMMENT 'refId'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`refId\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`profileId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง profile'`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`position\` varchar(255) NULL COMMENT 'ตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`org\` varchar(255) NULL COMMENT 'หน่วยงาน'`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD CONSTRAINT \`FK_fb29bfd315d0d43d0b49b362995\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}

View file

@ -1,20 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateProfileDevelopment21727851675456 implements MigrationInterface {
name = 'UpdateProfileDevelopment21727851675456'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`firstName\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`lastName\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`prefix\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`fullName\` varchar(255) NULL COMMENT 'ชื่อ-สกุล'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`fullName\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`prefix\` varchar(255) NULL COMMENT 'คำนำหน้า'`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`lastName\` varchar(255) NULL COMMENT 'สกุล'`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`firstName\` varchar(255) NULL COMMENT 'ชื่อ'`);
}
}

View file

@ -1,20 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateProfileDevelopment31727852313568 implements MigrationInterface {
name = 'UpdateProfileDevelopment31727852313568'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`fullName\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`prefix\` varchar(255) NULL COMMENT 'คำนำหน้า'`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`firstName\` varchar(255) NULL COMMENT 'ชื่อ'`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`lastName\` varchar(255) NULL COMMENT 'สกุล'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`lastName\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`firstName\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`prefix\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`fullName\` varchar(255) NULL COMMENT 'ชื่อ-สกุล'`);
}
}

View file

@ -1,22 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableAssign1728290588277 implements MigrationInterface {
name = 'AddTableAssign1728290588277'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`posMasterAssign\` (\`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', \`posMasterId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง posMaster', \`assignId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง assign', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`assign\` (\`id\` varchar(255) NOT NULL COMMENT 'ไอดีหลักของตาราง', \`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', \`name\` varchar(255) NULL COMMENT 'ชื่อระบบ', \`description\` varchar(255) NULL COMMENT 'รายละเอียด', \`commandSysId\` varchar(255) NULL COMMENT 'คีย์นอก(FK)ของตาราง CommandSys', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`posMasterAssign\` ADD CONSTRAINT \`FK_f5ae6d6c7bc95f304d8652577c4\` FOREIGN KEY (\`posMasterId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`posMasterAssign\` ADD CONSTRAINT \`FK_6eab8fe0c6745fce4e584d612a1\` FOREIGN KEY (\`assignId\`) REFERENCES \`assign\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`assign\` ADD CONSTRAINT \`FK_e5f8c525f66832567d1c82361df\` FOREIGN KEY (\`commandSysId\`) REFERENCES \`commandSys\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`assign\` DROP FOREIGN KEY \`FK_e5f8c525f66832567d1c82361df\``);
await queryRunner.query(`ALTER TABLE \`posMasterAssign\` DROP FOREIGN KEY \`FK_6eab8fe0c6745fce4e584d612a1\``);
await queryRunner.query(`ALTER TABLE \`posMasterAssign\` DROP FOREIGN KEY \`FK_f5ae6d6c7bc95f304d8652577c4\``);
await queryRunner.query(`DROP TABLE \`assign\``);
await queryRunner.query(`DROP TABLE \`posMasterAssign\``);
}
}

View file

@ -1,14 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableAssign11728318691161 implements MigrationInterface {
name = 'AddTableAssign11728318691161'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง profile'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`profileId\``);
}
}

View file

@ -1,28 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableWorkflow1728399911271 implements MigrationInterface {
name = 'AddTableWorkflow1728399911271'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`stateOperator\` (\`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', \`operator\` varchar(255) NULL COMMENT 'ผู้ดำเนินการ', \`canView\` tinyint NOT NULL COMMENT 'ดูเอกสาร' DEFAULT 0, \`canUpdate\` tinyint NOT NULL COMMENT 'แก้ไขเอกสาร' DEFAULT 0, \`canDelete\` tinyint NOT NULL COMMENT 'ลบเอกสาร' DEFAULT 0, \`canCancel\` tinyint NOT NULL COMMENT 'ยกเลิกเอกสาร' DEFAULT 0, \`canOperate\` tinyint NOT NULL COMMENT 'ดำเนินการเอกสาร' DEFAULT 0, \`canChangeState\` tinyint NOT NULL COMMENT 'เปลี่ยนสถานะเอกสาร' DEFAULT 0, \`canComment\` tinyint NOT NULL COMMENT 'แสดงความเห็นเอกสาร' DEFAULT 0, \`canSign\` tinyint NOT NULL COMMENT 'ลงนามอนุมัติ' DEFAULT 0, \`stateId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง state', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`state\` (\`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', \`name\` varchar(255) NULL COMMENT 'ชื่อประเภทขั้นตอน', \`type\` varchar(255) NULL COMMENT 'ประเภทขั้นตอน', \`order\` varchar(255) NULL COMMENT 'ลำดับ', \`workflowId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง workflow', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`workflow\` (\`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', \`name\` varchar(255) NULL COMMENT 'ชื่อ flow', \`category\` varchar(255) NULL COMMENT 'ระบบ', \`commandSysId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง commandSys', \`posLevelId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง posLevel', \`posTypeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง posType', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`stateOperator\` ADD CONSTRAINT \`FK_72292e09e5c83c34016a4b17ce4\` FOREIGN KEY (\`stateId\`) REFERENCES \`state\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`state\` ADD CONSTRAINT \`FK_fad8656b57142ed4a41584057a7\` FOREIGN KEY (\`workflowId\`) REFERENCES \`workflow\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`workflow\` ADD CONSTRAINT \`FK_248dca7108cc3ba484d7eac2bc2\` FOREIGN KEY (\`commandSysId\`) REFERENCES \`commandSys\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`workflow\` ADD CONSTRAINT \`FK_0eadcb967c5bdb18867395b8bf9\` FOREIGN KEY (\`posLevelId\`) REFERENCES \`posLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`workflow\` ADD CONSTRAINT \`FK_77889a7cde943b64fc28dd06025\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`workflow\` DROP FOREIGN KEY \`FK_77889a7cde943b64fc28dd06025\``);
await queryRunner.query(`ALTER TABLE \`workflow\` DROP FOREIGN KEY \`FK_0eadcb967c5bdb18867395b8bf9\``);
await queryRunner.query(`ALTER TABLE \`workflow\` DROP FOREIGN KEY \`FK_248dca7108cc3ba484d7eac2bc2\``);
await queryRunner.query(`ALTER TABLE \`state\` DROP FOREIGN KEY \`FK_fad8656b57142ed4a41584057a7\``);
await queryRunner.query(`ALTER TABLE \`stateOperator\` DROP FOREIGN KEY \`FK_72292e09e5c83c34016a4b17ce4\``);
await queryRunner.query(`DROP TABLE \`workflow\``);
await queryRunner.query(`DROP TABLE \`state\``);
await queryRunner.query(`DROP TABLE \`stateOperator\``);
}
}

View file

@ -1,30 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableWorkflow11728442861469 implements MigrationInterface {
name = 'AddTableWorkflow11728442861469'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`workflow\` DROP FOREIGN KEY \`FK_0eadcb967c5bdb18867395b8bf9\``);
await queryRunner.query(`ALTER TABLE \`workflow\` DROP FOREIGN KEY \`FK_248dca7108cc3ba484d7eac2bc2\``);
await queryRunner.query(`ALTER TABLE \`workflow\` DROP FOREIGN KEY \`FK_77889a7cde943b64fc28dd06025\``);
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`commandSysId\``);
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`posLevelId\``);
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`posTypeId\``);
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`commandSysName\` varchar(100) NULL COMMENT 'ชื่อระบบ'`);
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`posLevelName\` varchar(100) NULL COMMENT 'ชื่อระดับ'`);
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`posTypeName\` varchar(100) NULL COMMENT 'ชื่อประเภท'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`posTypeName\``);
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`posLevelName\``);
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`commandSysName\``);
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`posTypeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง posType'`);
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`posLevelId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง posLevel'`);
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`commandSysId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง commandSys'`);
await queryRunner.query(`ALTER TABLE \`workflow\` ADD CONSTRAINT \`FK_77889a7cde943b64fc28dd06025\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`workflow\` ADD CONSTRAINT \`FK_248dca7108cc3ba484d7eac2bc2\` FOREIGN KEY (\`commandSysId\`) REFERENCES \`commandSys\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`workflow\` ADD CONSTRAINT \`FK_0eadcb967c5bdb18867395b8bf9\` FOREIGN KEY (\`posLevelId\`) REFERENCES \`posLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}

View file

@ -1,26 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableWorkflow21728456793035 implements MigrationInterface {
name = 'AddTableWorkflow21728456793035'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`workflow\` CHANGE \`commandSysName\` \`sysName\` varchar(100) NULL COMMENT 'ชื่อระบบ'`);
await queryRunner.query(`CREATE TABLE \`stateOperatorUser\` (\`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', \`profile\` varchar(255) NULL, \`type\` varchar(255) NULL, \`order\` int NULL COMMENT 'ลำดับ', \`stateOperatorId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง stateOperator', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`isBangkok\``);
await queryRunner.query(`ALTER TABLE \`command\` ADD \`isBangkok\` varchar(20) NULL COMMENT 'คำสั่งกรุงเทพมหานคร'`);
await queryRunner.query(`ALTER TABLE \`state\` DROP COLUMN \`order\``);
await queryRunner.query(`ALTER TABLE \`state\` ADD \`order\` int NULL COMMENT 'ลำดับ'`);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` ADD CONSTRAINT \`FK_bef7391c37f03a3b809406beebf\` FOREIGN KEY (\`stateOperatorId\`) REFERENCES \`stateOperator\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` DROP FOREIGN KEY \`FK_bef7391c37f03a3b809406beebf\``);
await queryRunner.query(`ALTER TABLE \`state\` DROP COLUMN \`order\``);
await queryRunner.query(`ALTER TABLE \`state\` ADD \`order\` varchar(255) NULL COMMENT 'ลำดับ'`);
await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`isBangkok\``);
await queryRunner.query(`ALTER TABLE \`command\` ADD \`isBangkok\` tinyint NULL COMMENT 'คำสั่งกรุงเทพมหานคร'`);
await queryRunner.query(`DROP TABLE \`stateOperatorUser\``);
await queryRunner.query(`ALTER TABLE \`workflow\` CHANGE \`sysName\` \`commandSysName\` varchar(100) NULL COMMENT 'ชื่อระบบ'`);
}
}

View file

@ -1,26 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableWorkflow31728465477520 implements MigrationInterface {
name = 'AddTableWorkflow31728465477520'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` DROP FOREIGN KEY \`FK_bef7391c37f03a3b809406beebf\``);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` DROP COLUMN \`stateOperatorId\``);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` DROP COLUMN \`type\``);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` ADD \`operator\` varchar(255) NULL COMMENT 'ผู้ดำเนินการ'`);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` ADD \`refId\` varchar(255) NULL COMMENT 'ผู้ดำเนินการ'`);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` ADD \`workflowId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง workflow'`);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` ADD CONSTRAINT \`FK_9499ff9ae0444f59f19800aca05\` FOREIGN KEY (\`workflowId\`) REFERENCES \`workflow\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` DROP FOREIGN KEY \`FK_9499ff9ae0444f59f19800aca05\``);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` DROP COLUMN \`workflowId\``);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` DROP COLUMN \`refId\``);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` DROP COLUMN \`operator\``);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` ADD \`type\` varchar(255) NULL`);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` ADD \`stateOperatorId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง stateOperator'`);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` ADD CONSTRAINT \`FK_bef7391c37f03a3b809406beebf\` FOREIGN KEY (\`stateOperatorId\`) REFERENCES \`stateOperator\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}

View file

@ -1,22 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableWorkflow41728618339457 implements MigrationInterface {
name = 'AddTableWorkflow41728618339457'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`metaStateOperator\` (\`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', \`operator\` varchar(255) NULL COMMENT 'ผู้ดำเนินการ', \`canView\` tinyint NOT NULL COMMENT 'ดูเอกสาร' DEFAULT 0, \`canUpdate\` tinyint NOT NULL COMMENT 'แก้ไขเอกสาร' DEFAULT 0, \`canDelete\` tinyint NOT NULL COMMENT 'ลบเอกสาร' DEFAULT 0, \`canCancel\` tinyint NOT NULL COMMENT 'ยกเลิกเอกสาร' DEFAULT 0, \`canOperate\` tinyint NOT NULL COMMENT 'ดำเนินการเอกสาร' DEFAULT 0, \`canChangeState\` tinyint NOT NULL COMMENT 'เปลี่ยนสถานะเอกสาร' DEFAULT 0, \`canComment\` tinyint NOT NULL COMMENT 'แสดงความเห็นเอกสาร' DEFAULT 0, \`canSign\` tinyint NOT NULL COMMENT 'ลงนามอนุมัติ' DEFAULT 0, \`metaStateId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง metaState', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`metaState\` (\`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', \`name\` varchar(255) NULL COMMENT 'ชื่อประเภทขั้นตอน', \`type\` varchar(255) NULL COMMENT 'ประเภทขั้นตอน', \`order\` int NULL COMMENT 'ลำดับ', \`metaWorkflowId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง metaWorkflow', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`metaWorkflow\` (\`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', \`name\` varchar(255) NULL COMMENT 'ชื่อ flow', \`category\` varchar(255) NULL COMMENT 'ระบบ', \`sysName\` varchar(100) NULL COMMENT 'ชื่อระบบ', \`posLevelName\` varchar(100) NULL COMMENT 'ชื่อระดับ', \`posTypeName\` varchar(100) NULL COMMENT 'ชื่อประเภท', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`metaStateOperator\` ADD CONSTRAINT \`FK_b7489ef0f2b87666caecaadeb1e\` FOREIGN KEY (\`metaStateId\`) REFERENCES \`metaState\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`metaState\` ADD CONSTRAINT \`FK_73a4a241baa54b4e454f6914e4a\` FOREIGN KEY (\`metaWorkflowId\`) REFERENCES \`metaWorkflow\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`metaState\` DROP FOREIGN KEY \`FK_73a4a241baa54b4e454f6914e4a\``);
await queryRunner.query(`ALTER TABLE \`metaStateOperator\` DROP FOREIGN KEY \`FK_b7489ef0f2b87666caecaadeb1e\``);
await queryRunner.query(`DROP TABLE \`metaWorkflow\``);
await queryRunner.query(`DROP TABLE \`metaState\``);
await queryRunner.query(`DROP TABLE \`metaStateOperator\``);
}
}

View file

@ -1,14 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableWorkflow51729044078594 implements MigrationInterface {
name = 'AddTableWorkflow51729044078594'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`stateId\` varchar(100) NULL COMMENT 'id state'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`stateId\``);
}
}

View file

@ -1,26 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableWorkflow61729047708690 implements MigrationInterface {
name = 'AddTableWorkflow61729047708690'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` CHANGE \`profile\` \`profileId\` varchar(255) NULL`);
await queryRunner.query(`CREATE TABLE \`stateUserComment\` (\`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', \`isAccept\` tinyint NULL COMMENT 'เลือกรับทราบ', \`isApprove\` tinyint NULL COMMENT 'เลือกพิจารณา', \`reason\` varchar(255) NULL COMMENT 'แสดงความคิดเห็น', \`isAcceptSetting\` tinyint NOT NULL COMMENT 'เลือกรับทราบ' DEFAULT 0, \`isApproveSetting\` tinyint NOT NULL COMMENT 'เลือกพิจารณา' DEFAULT 0, \`isReasonSetting\` tinyint NOT NULL COMMENT 'แสดงความคิดเห็น' DEFAULT 0, \`order\` int NULL COMMENT 'ลำดับ', \`stateId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง state', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง profile', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` DROP COLUMN \`profileId\``);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` ADD \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง profile'`);
await queryRunner.query(`ALTER TABLE \`stateUserComment\` ADD CONSTRAINT \`FK_f6ed25f165eb356ea5499484452\` FOREIGN KEY (\`stateId\`) REFERENCES \`state\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`stateUserComment\` ADD CONSTRAINT \`FK_f83cf9aef7ece2cddc2bb7c5a55\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` ADD CONSTRAINT \`FK_f64285e5016ad2932f38c8687a1\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` DROP FOREIGN KEY \`FK_f64285e5016ad2932f38c8687a1\``);
await queryRunner.query(`ALTER TABLE \`stateUserComment\` DROP FOREIGN KEY \`FK_f83cf9aef7ece2cddc2bb7c5a55\``);
await queryRunner.query(`ALTER TABLE \`stateUserComment\` DROP FOREIGN KEY \`FK_f6ed25f165eb356ea5499484452\``);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` DROP COLUMN \`profileId\``);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` ADD \`profileId\` varchar(255) NULL`);
await queryRunner.query(`DROP TABLE \`stateUserComment\``);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` CHANGE \`profileId\` \`profile\` varchar(255) NULL`);
}
}

View file

@ -1,16 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableWorkflow71729055668134 implements MigrationInterface {
name = 'AddTableWorkflow71729055668134'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`refId\` varchar(255) NULL COMMENT 'refIdw'`);
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`system\` varchar(255) NULL COMMENT 'system'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`system\``);
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`refId\``);
}
}

View file

@ -1,16 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableWorkflow81729073909711 implements MigrationInterface {
name = 'AddTableWorkflow81729073909711'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`system\``);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` DROP COLUMN \`refId\``);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` ADD \`refId\` varchar(255) NULL COMMENT 'ผู้ดำเนินการ'`);
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`system\` varchar(255) NULL COMMENT 'system'`);
}
}

View file

@ -1,16 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateProfilesalaryDateGovernment1729159077554 implements MigrationInterface {
name = 'UpdateProfilesalaryDateGovernment1729159077554'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`dateGovernment\` datetime NULL COMMENT 'วันที่'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`isGovernment\` tinyint NULL COMMENT 'เข้ารับราชการ'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`isGovernment\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`dateGovernment\``);
}
}

View file

@ -1,16 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateProfilesalaryCommandId1729169375946 implements MigrationInterface {
name = 'UpdateProfilesalaryCommandId1729169375946'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`commandId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง command'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD CONSTRAINT \`FK_5aa33e13619d0c878032e2dc1bd\` FOREIGN KEY (\`commandId\`) REFERENCES \`command\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP FOREIGN KEY \`FK_5aa33e13619d0c878032e2dc1bd\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`commandId\``);
}
}

View file

@ -1,14 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateProfilesalaryCommandId11729172500950 implements MigrationInterface {
name = 'UpdateProfilesalaryCommandId11729172500950'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`statusReport\` varchar(20) NOT NULL COMMENT 'สถานะออกคำสั่ง' DEFAULT 'PENDING'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`statusReport\``);
}
}

View file

@ -1,16 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateProfileAddConemail1729228451049 implements MigrationInterface {
name = 'UpdateProfileAddConemail1729228451049'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`statusEmail\` varchar(255) NULL COMMENT 'สถานะอีเมล'`);
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`statusEmail\` varchar(255) NULL COMMENT 'สถานะอีเมล'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`statusEmail\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`statusEmail\``);
}
}

View file

@ -1,18 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateWorkflowAddPath1729480130391 implements MigrationInterface {
name = 'UpdateWorkflowAddPath1729480130391'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`assign\` ADD \`path\` text NULL COMMENT 'path link'`);
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`commandId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง command'`);
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD CONSTRAINT \`FK_8ba1f49c8315bf86848ebcb29f5\` FOREIGN KEY (\`commandId\`) REFERENCES \`command\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP FOREIGN KEY \`FK_8ba1f49c8315bf86848ebcb29f5\``);
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`commandId\``);
await queryRunner.query(`ALTER TABLE \`assign\` DROP COLUMN \`path\``);
}
}

View file

@ -1,14 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateRootAddIsdeputy1729505298515 implements MigrationInterface {
name = 'UpdateRootAddIsdeputy1729505298515'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD \`isDeputy\` tinyint NOT NULL COMMENT 'เป็นปลัด' DEFAULT 0`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP COLUMN \`isDeputy\``);
}
}

View file

@ -1,14 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateRootAddIsdeputy11729617727307 implements MigrationInterface {
name = 'UpdateRootAddIsdeputy11729617727307'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMasterAct\` ADD \`statusReport\` varchar(20) NOT NULL COMMENT 'สถานะออกคำสั่ง' DEFAULT 'PENDING'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMasterAct\` DROP COLUMN \`statusReport\``);
}
}

View file

@ -1,55 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateRootAddIsdeputy31729753908963 implements MigrationInterface {
name = 'UpdateRootAddIsdeputy31729753908963'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_commander_director","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_commander_director\``);
await queryRunner.query(`CREATE VIEW \`view_commander_director\` AS SELECT
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`Id\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\` AS \`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\` AS \`firstName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\` AS \`lastName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`citizenId\` AS \`citizenId\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`position\` AS \`position\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
NULL AS \`actFullName\`
FROM
(\`bma_ehr_organization_demo\`.\`posMaster\`
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))
UNION SELECT
\`profileChild\`.\`id\` AS \`Id\`,
\`profileChild\`.\`prefix\` AS \`prefix\`,
\`profileChild\`.\`firstName\` AS \`firstName\`,
\`profileChild\`.\`lastName\` AS \`lastName\`,
\`profileChild\`.\`citizenId\` AS \`citizenId\`,
\`profileChild\`.\`position\` AS \`position\`,
\`posMasterChild\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
' ',
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\`) AS \`actFullName\`
FROM
((((\`bma_ehr_organization_demo\`.\`posMasterAct\`
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` \`posMasterChild\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterId\` = \`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))
`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_commander_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n NULL AS `actFullName`\n FROM\n (`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`))) \n UNION SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n `posMasterChild`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n ((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_commander_director","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_commander_director\``);
await queryRunner.query(`CREATE VIEW \`view_commander_director\` AS SELECT \`profile\`.\`id\` AS \`id\`,\`profile\`.\`prefix\` AS \`prefix\`,\`profile\`.\`firstName\` AS \`firstName\`,\`profile\`.\`lastName\` AS \`lastName\`,\`profile\`.\`citizenId\` AS \`citizenId\`,\`profile\`.\`position\` AS \`position\`,\`posMaster\`.\`isDirector\` AS \`isDirector\`,\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,NULL AS \`actFullName\`
FROM (\`posMaster\` JOIN \`profile\` ON ((\`posMaster\`.\`current_holderId\` = \`profile\`.\`id\`)))
UNION SELECT \`profileChild\`.\`id\` AS \`id\`,\`profileChild\`.\`prefix\` AS \`prefix\`,\`profileChild\`.\`firstName\` AS \`firstName\`,\`profileChild\`.\`lastName\` AS \`lastName\`,\`profileChild\`.\`citizenId\` AS \`citizenId\`,\`profileChild\`.\`position\` AS \`position\`,\`posMasterChild\`.\`isDirector\` AS \`isDirector\`,\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,CONCAT(\`profile\`.\`prefix\`,\`profile\`.\`firstName\`,' ',\`profile\`.\`lastName\`) AS \`actFullName\`
FROM((((\`posMasterAct\` JOIN \`posMaster\` \`posMasterChild\` ON ((\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`))) JOIN \`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`))) JOIN \`posMaster\` ON ((\`posMasterAct\`.\`posMasterId\` = \`posMaster\`.\`id\`))) JOIN \`profile\` ON ((\`posMaster\`.\`current_holderId\` = \`profile\`.\`id\`)))`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_commander_director","SELECT `profile`.`id` AS `id`,`profile`.`prefix` AS `prefix`,`profile`.`firstName` AS `firstName`,`profile`.`lastName` AS `lastName`,`profile`.`citizenId` AS `citizenId`,`profile`.`position` AS `position`,`posMaster`.`isDirector` AS `isDirector`,`posMaster`.`orgRootId` AS `orgRootId`,NULL AS `actFullName`\n FROM (`posMaster` JOIN `profile` ON ((`posMaster`.`current_holderId` = `profile`.`id`))) \n UNION SELECT `profileChild`.`id` AS `id`,`profileChild`.`prefix` AS `prefix`,`profileChild`.`firstName` AS `firstName`,`profileChild`.`lastName` AS `lastName`,`profileChild`.`citizenId` AS `citizenId`,`profileChild`.`position` AS `position`,`posMasterChild`.`isDirector` AS `isDirector`,`posMaster`.`orgRootId` AS `orgRootId`,CONCAT(`profile`.`prefix`,`profile`.`firstName`,' ',`profile`.`lastName`) AS `actFullName`\n FROM((((`posMasterAct` JOIN `posMaster` `posMasterChild` ON ((`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`))) JOIN `profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`))) JOIN `posMaster` ON ((`posMasterAct`.`posMasterId` = `posMaster`.`id`))) JOIN `profile` ON ((`posMaster`.`current_holderId` = `profile`.`id`)))"]);
}
}

View file

@ -1,62 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableViewCommanderDirector1729754336397 implements MigrationInterface {
name = 'AddTableViewCommanderDirector1729754336397'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_commander_director","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_commander_director\``);
await queryRunner.query(`CREATE VIEW \`view_commander_director\` AS SELECT
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`Id\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\` AS \`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\` AS \`firstName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\` AS \`lastName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`citizenId\` AS \`citizenId\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`position\` AS \`position\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
NULL AS \`actFullName\`
FROM
(((\`bma_ehr_organization_demo\`.\`posMaster\`
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))
UNION SELECT
\`profileChild\`.\`id\` AS \`Id\`,
\`profileChild\`.\`prefix\` AS \`prefix\`,
\`profileChild\`.\`firstName\` AS \`firstName\`,
\`profileChild\`.\`lastName\` AS \`lastName\`,
\`profileChild\`.\`citizenId\` AS \`citizenId\`,
\`profileChild\`.\`position\` AS \`position\`,
\`posMasterChild\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
' ',
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\`) AS \`actFullName\`
FROM
((((((\`bma_ehr_organization_demo\`.\`posMasterAct\`
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` \`posMasterChild\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`profileChild\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`profileChild\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterId\` = \`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_commander_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n NULL AS `actFullName`\n FROM\n (((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`))) \n UNION SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n `posMasterChild`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n ((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_commander_director","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_commander_director\``);
await queryRunner.query(`CREATE VIEW \`view_commander_director\` AS SELECT \`profile\`.\`id\` AS \`id\`,\`profile\`.\`prefix\` AS \`prefix\`,\`profile\`.\`firstName\` AS \`firstName\`,\`profile\`.\`lastName\` AS \`lastName\`,\`profile\`.\`citizenId\` AS \`citizenId\`,\`profile\`.\`position\` AS \`position\`,\`posMaster\`.\`isDirector\` AS \`isDirector\`,\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,NULL AS \`actFullName\`
FROM (\`posMaster\` JOIN \`profile\` ON ((\`posMaster\`.\`current_holderId\` = \`profile\`.\`id\`)))
UNION SELECT \`profileChild\`.\`id\` AS \`id\`,\`profileChild\`.\`prefix\` AS \`prefix\`,\`profileChild\`.\`firstName\` AS \`firstName\`,\`profileChild\`.\`lastName\` AS \`lastName\`,\`profileChild\`.\`citizenId\` AS \`citizenId\`,\`profileChild\`.\`position\` AS \`position\`,\`posMasterChild\`.\`isDirector\` AS \`isDirector\`,\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,CONCAT(\`profile\`.\`prefix\`,\`profile\`.\`firstName\`,' ',\`profile\`.\`lastName\`) AS \`actFullName\`
FROM((((\`posMasterAct\` JOIN \`posMaster\` \`posMasterChild\` ON ((\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`))) JOIN \`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`))) JOIN \`posMaster\` ON ((\`posMasterAct\`.\`posMasterId\` = \`posMaster\`.\`id\`))) JOIN \`profile\` ON ((\`posMaster\`.\`current_holderId\` = \`profile\`.\`id\`)))`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_commander_director","SELECT `profile`.`id` AS `id`,`profile`.`prefix` AS `prefix`,`profile`.`firstName` AS `firstName`,`profile`.`lastName` AS `lastName`,`profile`.`citizenId` AS `citizenId`,`profile`.`position` AS `position`,`posMaster`.`isDirector` AS `isDirector`,`posMaster`.`orgRootId` AS `orgRootId`,NULL AS `actFullName`\n FROM (`posMaster` JOIN `profile` ON ((`posMaster`.`current_holderId` = `profile`.`id`))) \n UNION SELECT `profileChild`.`id` AS `id`,`profileChild`.`prefix` AS `prefix`,`profileChild`.`firstName` AS `firstName`,`profileChild`.`lastName` AS `lastName`,`profileChild`.`citizenId` AS `citizenId`,`profileChild`.`position` AS `position`,`posMasterChild`.`isDirector` AS `isDirector`,`posMaster`.`orgRootId` AS `orgRootId`,CONCAT(`profile`.`prefix`,`profile`.`firstName`,' ',`profile`.`lastName`) AS `actFullName`\n FROM((((`posMasterAct` JOIN `posMaster` `posMasterChild` ON ((`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`))) JOIN `profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`))) JOIN `posMaster` ON ((`posMasterAct`.`posMasterId` = `posMaster`.`id`))) JOIN `profile` ON ((`posMaster`.`current_holderId` = `profile`.`id`)))"]);
}
}

View file

@ -1,18 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdataTablePosmasterAddCondition1730381986173 implements MigrationInterface {
name = 'UpdataTablePosmasterAddCondition1730381986173'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`metaStateOperator\` DROP COLUMN \`Column18\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`isCondition\` tinyint NOT NULL COMMENT 'ตำแหน่งติดเงื่อนไข' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`conditionReason\` text NULL COMMENT 'หมายเหตุตำแหน่งติดเงื่อนไข'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`conditionReason\``);
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`isCondition\``);
await queryRunner.query(`ALTER TABLE \`metaStateOperator\` ADD \`Column18\` varchar(50) NULL`);
}
}

View file

@ -1,18 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableCommandSign1730456393834 implements MigrationInterface {
name = 'AddTableCommandSign1730456393834'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`commandSign\` (\`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', \`prefix\` varchar(255) NULL COMMENT 'คำนำหน้า', \`firstName\` varchar(255) NULL COMMENT 'ชื่อ', \`lastName\` varchar(255) NULL COMMENT 'สกุล', \`position\` varchar(255) NULL COMMENT 'ตำแหน่ง', \`comment\` varchar(255) NULL COMMENT 'ความเห็น', \`isActive\` tinyint NOT NULL COMMENT 'เป็นผู้มีอำนาจลงนาม' DEFAULT 0, \`commandId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง command', \`profileId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง profile', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`commandSign\` ADD CONSTRAINT \`FK_143488a80d2317daa9333e1a726\` FOREIGN KEY (\`commandId\`) REFERENCES \`command\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`commandSign\` ADD CONSTRAINT \`FK_748a443f8f9d4fa32dfddad0b2e\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandSign\` DROP FOREIGN KEY \`FK_748a443f8f9d4fa32dfddad0b2e\``);
await queryRunner.query(`ALTER TABLE \`commandSign\` DROP FOREIGN KEY \`FK_143488a80d2317daa9333e1a726\``);
await queryRunner.query(`DROP TABLE \`commandSign\``);
}
}

View file

@ -1,14 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableCommandSign11730463698383 implements MigrationInterface {
name = 'AddTableCommandSign11730463698383'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandSign\` CHANGE \`isActive\` \`isSignatory\` tinyint NOT NULL COMMENT 'เป็นผู้มีอำนาจลงนาม' DEFAULT '0'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandSign\` CHANGE \`isSignatory\` \`isActive\` tinyint NOT NULL COMMENT 'เป็นผู้มีอำนาจลงนาม' DEFAULT '0'`);
}
}

View file

@ -1,58 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableCommandSign21730703510080 implements MigrationInterface {
name = 'AddTableCommandSign21730703510080'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS SELECT
\`profileChild\`.\`id\` AS \`Id\`,
\`profileChild\`.\`prefix\` AS \`prefix\`,
\`profileChild\`.\`firstName\` AS \`firstName\`,
\`profileChild\`.\`lastName\` AS \`lastName\`,
\`profileChild\`.\`citizenId\` AS \`citizenId\`,
\`profileChild\`.\`position\` AS \`position\`,
\`posMasterChild\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
' ',
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\`) AS \`actFullName\`
FROM
((((((\`bma_ehr_organization_demo\`.\`posMasterAct\`
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` \`posMasterChild\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`profileChild\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`profileChild\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterId\` = \`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n `posMasterChild`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n ((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
await queryRunner.query(`CREATE VIEW \`view_director\` AS SELECT
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`Id\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\` AS \`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\` AS \`firstName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\` AS \`lastName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`citizenId\` AS \`citizenId\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`position\` AS \`position\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
NULL AS \`actFullName\`
FROM
(((\`bma_ehr_organization_demo\`.\`posMaster\`
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n NULL AS `actFullName`\n FROM\n (((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_director\``);
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_director_acting\``);
}
}

View file

@ -1,24 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdataTableProfileAddSalary1730773461743 implements MigrationInterface {
name = 'UpdataTableProfileAddSalary1730773461743'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`amount\` double NULL COMMENT 'เงินเดือนฐาน' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`positionSalaryAmount\` double NULL COMMENT 'เงินประจำตำแหน่ง' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`mouthSalaryAmount\` double NULL COMMENT 'เงินค่าตอบแทนรายเดือน' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`amount\` double NULL COMMENT 'เงินเดือนฐาน' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`positionSalaryAmount\` double NULL COMMENT 'เงินประจำตำแหน่ง' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`mouthSalaryAmount\` double NULL COMMENT 'เงินค่าตอบแทนรายเดือน' DEFAULT '0'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`mouthSalaryAmount\``);
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`positionSalaryAmount\``);
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`amount\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`mouthSalaryAmount\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`positionSalaryAmount\``);
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`amount\``);
}
}

View file

@ -1,24 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdataTableProfileAddSalary11730774144012 implements MigrationInterface {
name = 'UpdataTableProfileAddSalary11730774144012'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`amount\` double NULL COMMENT 'เงินเดือนฐาน' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`positionSalaryAmount\` double NULL COMMENT 'เงินประจำตำแหน่ง' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`mouthSalaryAmount\` double NULL COMMENT 'เงินค่าตอบแทนรายเดือน' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`amount\` double NULL COMMENT 'เงินเดือนฐาน' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`positionSalaryAmount\` double NULL COMMENT 'เงินประจำตำแหน่ง' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`mouthSalaryAmount\` double NULL COMMENT 'เงินค่าตอบแทนรายเดือน' DEFAULT '0'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`mouthSalaryAmount\``);
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`positionSalaryAmount\``);
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`amount\``);
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`mouthSalaryAmount\``);
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`positionSalaryAmount\``);
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`amount\``);
}
}

View file

@ -1,62 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableViewAddPosNo1730775622890 implements MigrationInterface {
name = 'UpdateTableViewAddPosNo1730775622890'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS SELECT
\`profileChild\`.\`id\` AS \`Id\`,
\`profileChild\`.\`prefix\` AS \`prefix\`,
\`profileChild\`.\`firstName\` AS \`firstName\`,
\`profileChild\`.\`lastName\` AS \`lastName\`,
\`profileChild\`.\`citizenId\` AS \`citizenId\`,
\`profileChild\`.\`position\` AS \`position\`,
NULL AS \`posNo\`,
\`posMasterChild\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
' ',
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\`) AS \`actFullName\`
FROM
((((((\`bma_ehr_organization_demo\`.\`posMasterAct\`
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` \`posMasterChild\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`profileChild\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`profileChild\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterId\` = \`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n NULL AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n ((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
await queryRunner.query(`CREATE VIEW \`view_director\` AS SELECT
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`Id\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\` AS \`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\` AS \`firstName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\` AS \`lastName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`citizenId\` AS \`citizenId\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`position\` AS \`position\`,
NULL AS \`posNo\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
NULL AS \`actFullNameId\`,
NULL AS \`actFullName\`
FROM
(((\`bma_ehr_organization_demo\`.\`posMaster\`
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n NULL AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n (((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_director\``);
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_director_acting\``);
}
}

View file

@ -1,74 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableViewAddPosNo11730778247768 implements MigrationInterface {
name = 'UpdateTableViewAddPosNo11730778247768'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS SELECT
\`profileChild\`.\`id\` AS \`Id\`,
\`profileChild\`.\`prefix\` AS \`prefix\`,
\`profileChild\`.\`firstName\` AS \`firstName\`,
\`profileChild\`.\`lastName\` AS \`lastName\`,
\`profileChild\`.\`citizenId\` AS \`citizenId\`,
\`profileChild\`.\`position\` AS \`position\`,
CONCAT((CASE
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`orgRootChild\`.\`orgRootShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`orgChild1Child\`.\`orgChild1ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`orgChild2Child\`.\`orgChild2ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`orgChild3Child\`.\`orgChild3ShortName\`
ELSE \`orgChild4Child\`.\`orgChild4ShortName\`
END),
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
\`posMasterChild\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
' ',
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\`) AS \`actFullName\`
FROM
(((((((((((\`bma_ehr_organization_demo\`.\`posMasterAct\`
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` \`posMasterChild\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` \`orgRootChild\` ON ((\`posMasterChild\`.\`orgRootId\` = \`orgRootChild\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` \`orgChild1Child\` ON ((\`posMasterChild\`.\`orgChild1Id\` = \`orgChild1Child\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` \`orgChild2Child\` ON ((\`posMasterChild\`.\`orgChild2Id\` = \`orgChild2Child\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` \`orgChild3Child\` ON ((\`posMasterChild\`.\`orgChild3Id\` = \`orgChild3Child\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` \`orgChild4Child\` ON ((\`posMasterChild\`.\`orgChild4Id\` = \`orgChild4Child\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`profileChild\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`profileChild\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterId\` = \`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n CONCAT((CASE\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` IS NULL) THEN `orgRootChild`.`orgRootShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` IS NULL) THEN `orgChild1Child`.`orgChild1ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` IS NULL) THEN `orgChild2Child`.`orgChild2ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` IS NULL) THEN `orgChild3Child`.`orgChild3ShortName`\n ELSE `orgChild4Child`.`orgChild4ShortName`\n END),\n `bma_ehr_organization_demo`.`posMaster`.`posMasterNo`) AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n (((((((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgRoot` `orgRootChild` ON ((`posMasterChild`.`orgRootId` = `orgRootChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild1` `orgChild1Child` ON ((`posMasterChild`.`orgChild1Id` = `orgChild1Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild2` `orgChild2Child` ON ((`posMasterChild`.`orgChild2Id` = `orgChild2Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild3` `orgChild3Child` ON ((`posMasterChild`.`orgChild3Id` = `orgChild3Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild4` `orgChild4Child` ON ((`posMasterChild`.`orgChild4Id` = `orgChild4Child`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
await queryRunner.query(`CREATE VIEW \`view_director\` AS SELECT
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`Id\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\` AS \`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\` AS \`firstName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\` AS \`lastName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`citizenId\` AS \`citizenId\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`position\` AS \`position\`,
NULL AS \`posNo\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
NULL AS \`actFullNameId\`,
NULL AS \`actFullName\`
FROM
(((\`bma_ehr_organization_demo\`.\`posMaster\`
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n NULL AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n (((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_director\``);
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_director_acting\``);
}
}

View file

@ -1,86 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableViewAddPosNo21730788285577 implements MigrationInterface {
name = 'UpdateTableViewAddPosNo21730788285577'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS SELECT
\`profileChild\`.\`id\` AS \`Id\`,
\`profileChild\`.\`prefix\` AS \`prefix\`,
\`profileChild\`.\`firstName\` AS \`firstName\`,
\`profileChild\`.\`lastName\` AS \`lastName\`,
\`profileChild\`.\`citizenId\` AS \`citizenId\`,
\`profileChild\`.\`position\` AS \`position\`,
CONCAT((CASE
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`orgRootChild\`.\`orgRootShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`orgChild1Child\`.\`orgChild1ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`orgChild2Child\`.\`orgChild2ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`orgChild3Child\`.\`orgChild3ShortName\`
ELSE \`orgChild4Child\`.\`orgChild4ShortName\`
END),
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
\`posMasterChild\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
' ',
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\`) AS \`actFullName\`
FROM
(((((((((((\`bma_ehr_organization_demo\`.\`posMasterAct\`
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` \`posMasterChild\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` \`orgRootChild\` ON ((\`posMasterChild\`.\`orgRootId\` = \`orgRootChild\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` \`orgChild1Child\` ON ((\`posMasterChild\`.\`orgChild1Id\` = \`orgChild1Child\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` \`orgChild2Child\` ON ((\`posMasterChild\`.\`orgChild2Id\` = \`orgChild2Child\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` \`orgChild3Child\` ON ((\`posMasterChild\`.\`orgChild3Id\` = \`orgChild3Child\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` \`orgChild4Child\` ON ((\`posMasterChild\`.\`orgChild4Id\` = \`orgChild4Child\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`profileChild\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`profileChild\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterId\` = \`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n CONCAT((CASE\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` IS NULL) THEN `orgRootChild`.`orgRootShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` IS NULL) THEN `orgChild1Child`.`orgChild1ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` IS NULL) THEN `orgChild2Child`.`orgChild2ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` IS NULL) THEN `orgChild3Child`.`orgChild3ShortName`\n ELSE `orgChild4Child`.`orgChild4ShortName`\n END),\n `bma_ehr_organization_demo`.`posMaster`.`posMasterNo`) AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n (((((((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgRoot` `orgRootChild` ON ((`posMasterChild`.`orgRootId` = `orgRootChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild1` `orgChild1Child` ON ((`posMasterChild`.`orgChild1Id` = `orgChild1Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild2` `orgChild2Child` ON ((`posMasterChild`.`orgChild2Id` = `orgChild2Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild3` `orgChild3Child` ON ((`posMasterChild`.`orgChild3Id` = `orgChild3Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild4` `orgChild4Child` ON ((`posMasterChild`.`orgChild4Id` = `orgChild4Child`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
await queryRunner.query(`CREATE VIEW \`view_director\` AS SELECT
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`Id\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\` AS \`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\` AS \`firstName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\` AS \`lastName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`citizenId\` AS \`citizenId\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`position\` AS \`position\`,
CONCAT((CASE
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgRoot\`.\`orgRootShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild1\`.\`orgChild1ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild2\`.\`orgChild2ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild3\`.\`orgChild3ShortName\`
ELSE \`bma_ehr_organization_demo\`.\`orgChild4\`.\`orgChild4ShortName\`
END),
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
NULL AS \`actFullNameId\`,
NULL AS \`actFullName\`
FROM
((((((((\`bma_ehr_organization_demo\`.\`posMaster\`
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` = \`bma_ehr_organization_demo\`.\`orgRoot\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` = \`bma_ehr_organization_demo\`.\`orgChild1\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` = \`bma_ehr_organization_demo\`.\`orgChild2\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` = \`bma_ehr_organization_demo\`.\`orgChild3\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` = \`bma_ehr_organization_demo\`.\`orgChild4\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n CONCAT((CASE\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgRoot`.`orgRootShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild1`.`orgChild1ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild2`.`orgChild2ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild3`.`orgChild3ShortName`\n ELSE `bma_ehr_organization_demo`.`orgChild4`.`orgChild4ShortName`\n END),\n `bma_ehr_organization_demo`.`posMaster`.`posMasterNo`) AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n ((((((((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgRoot` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgRootId` = `bma_ehr_organization_demo`.`orgRoot`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild1` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` = `bma_ehr_organization_demo`.`orgChild1`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild2` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` = `bma_ehr_organization_demo`.`orgChild2`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild3` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` = `bma_ehr_organization_demo`.`orgChild3`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild4` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` = `bma_ehr_organization_demo`.`orgChild4`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_director\``);
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_director_acting\``);
}
}

View file

@ -1,89 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableAppointDirectorAddPosNo11730885124771 implements MigrationInterface {
name = 'UpdateTableAppointDirectorAddPosNo11730885124771'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandSendCC\` CHANGE \`name\` \`name\` varchar(255) NULL COMMENT 'ชื่อ'`);
await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS SELECT
\`profileChild\`.\`id\` AS \`Id\`,
\`profileChild\`.\`prefix\` AS \`prefix\`,
\`profileChild\`.\`firstName\` AS \`firstName\`,
\`profileChild\`.\`lastName\` AS \`lastName\`,
\`profileChild\`.\`citizenId\` AS \`citizenId\`,
\`profileChild\`.\`position\` AS \`position\`,
CONCAT((CASE
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`orgRootChild\`.\`orgRootShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`orgChild1Child\`.\`orgChild1ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`orgChild2Child\`.\`orgChild2ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`orgChild3Child\`.\`orgChild3ShortName\`
ELSE \`orgChild4Child\`.\`orgChild4ShortName\`
END),
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
\`posMasterChild\`.\`isDirector\` AS \`isDirectorChild\`,
\`posMaster\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
' ',
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\`) AS \`actFullName\`
FROM
(((((((((((\`bma_ehr_organization_demo\`.\`posMasterAct\`
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` \`posMasterChild\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` \`orgRootChild\` ON ((\`posMasterChild\`.\`orgRootId\` = \`orgRootChild\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` \`orgChild1Child\` ON ((\`posMasterChild\`.\`orgChild1Id\` = \`orgChild1Child\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` \`orgChild2Child\` ON ((\`posMasterChild\`.\`orgChild2Id\` = \`orgChild2Child\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` \`orgChild3Child\` ON ((\`posMasterChild\`.\`orgChild3Id\` = \`orgChild3Child\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` \`orgChild4Child\` ON ((\`posMasterChild\`.\`orgChild4Id\` = \`orgChild4Child\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`profileChild\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`profileChild\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterId\` = \`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n CONCAT((CASE\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` IS NULL) THEN `orgRootChild`.`orgRootShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` IS NULL) THEN `orgChild1Child`.`orgChild1ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` IS NULL) THEN `orgChild2Child`.`orgChild2ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` IS NULL) THEN `orgChild3Child`.`orgChild3ShortName`\n ELSE `orgChild4Child`.`orgChild4ShortName`\n END),\n `bma_ehr_organization_demo`.`posMaster`.`posMasterNo`) AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirectorChild`,\n `posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n (((((((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgRoot` `orgRootChild` ON ((`posMasterChild`.`orgRootId` = `orgRootChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild1` `orgChild1Child` ON ((`posMasterChild`.`orgChild1Id` = `orgChild1Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild2` `orgChild2Child` ON ((`posMasterChild`.`orgChild2Id` = `orgChild2Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild3` `orgChild3Child` ON ((`posMasterChild`.`orgChild3Id` = `orgChild3Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild4` `orgChild4Child` ON ((`posMasterChild`.`orgChild4Id` = `orgChild4Child`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
await queryRunner.query(`CREATE VIEW \`view_director\` AS SELECT
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`Id\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\` AS \`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\` AS \`firstName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\` AS \`lastName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`citizenId\` AS \`citizenId\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`position\` AS \`position\`,
CONCAT((CASE
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgRoot\`.\`orgRootShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild1\`.\`orgChild1ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild2\`.\`orgChild2ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild3\`.\`orgChild3ShortName\`
ELSE \`bma_ehr_organization_demo\`.\`orgChild4\`.\`orgChild4ShortName\`
END),
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
NULL AS \`actFullNameId\`,
NULL AS \`actFullName\`
FROM
((((((((\`bma_ehr_organization_demo\`.\`posMaster\`
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` = \`bma_ehr_organization_demo\`.\`orgRoot\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` = \`bma_ehr_organization_demo\`.\`orgChild1\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` = \`bma_ehr_organization_demo\`.\`orgChild2\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` = \`bma_ehr_organization_demo\`.\`orgChild3\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` = \`bma_ehr_organization_demo\`.\`orgChild4\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n CONCAT((CASE\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgRoot`.`orgRootShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild1`.`orgChild1ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild2`.`orgChild2ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild3`.`orgChild3ShortName`\n ELSE `bma_ehr_organization_demo`.`orgChild4`.`orgChild4ShortName`\n END),\n `bma_ehr_organization_demo`.`posMaster`.`posMasterNo`) AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n ((((((((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgRoot` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgRootId` = `bma_ehr_organization_demo`.`orgRoot`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild1` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` = `bma_ehr_organization_demo`.`orgChild1`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild2` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` = `bma_ehr_organization_demo`.`orgChild2`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild3` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` = `bma_ehr_organization_demo`.`orgChild3`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild4` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` = `bma_ehr_organization_demo`.`orgChild4`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_director\``);
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_director_acting\``);
await queryRunner.query(`ALTER TABLE \`commandSendCC\` CHANGE \`name\` \`name\` varchar(255) NULL COMMENT 'เพศ'`);
}
}

View file

@ -1,91 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableAppointDirectorAddPosNo21730887635521 implements MigrationInterface {
name = 'UpdateTableAppointDirectorAddPosNo21730887635521'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS SELECT
\`profileChild\`.\`id\` AS \`Id\`,
\`profileChild\`.\`prefix\` AS \`prefix\`,
\`profileChild\`.\`firstName\` AS \`firstName\`,
\`profileChild\`.\`lastName\` AS \`lastName\`,
\`profileChild\`.\`citizenId\` AS \`citizenId\`,
\`profileChild\`.\`position\` AS \`position\`,
CONCAT((CASE
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`orgRootChild\`.\`orgRootShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`orgChild1Child\`.\`orgChild1ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`orgChild2Child\`.\`orgChild2ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`orgChild3Child\`.\`orgChild3ShortName\`
ELSE \`orgChild4Child\`.\`orgChild4ShortName\`
END),
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
\`posMasterChild\`.\`isDirector\` AS \`isDirectorChild\`,
\`posMaster\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
CONCAT(\`posMasterChild\`.\`id\`,
\`profileChild\`.\`id\`) AS \`key\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
' ',
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\`) AS \`actFullName\`
FROM
(((((((((((\`bma_ehr_organization_demo\`.\`posMasterAct\`
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` \`posMasterChild\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` \`orgRootChild\` ON ((\`posMasterChild\`.\`orgRootId\` = \`orgRootChild\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` \`orgChild1Child\` ON ((\`posMasterChild\`.\`orgChild1Id\` = \`orgChild1Child\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` \`orgChild2Child\` ON ((\`posMasterChild\`.\`orgChild2Id\` = \`orgChild2Child\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` \`orgChild3Child\` ON ((\`posMasterChild\`.\`orgChild3Id\` = \`orgChild3Child\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` \`orgChild4Child\` ON ((\`posMasterChild\`.\`orgChild4Id\` = \`orgChild4Child\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`profileChild\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`profileChild\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterId\` = \`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n CONCAT((CASE\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` IS NULL) THEN `orgRootChild`.`orgRootShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` IS NULL) THEN `orgChild1Child`.`orgChild1ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` IS NULL) THEN `orgChild2Child`.`orgChild2ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` IS NULL) THEN `orgChild3Child`.`orgChild3ShortName`\n ELSE `orgChild4Child`.`orgChild4ShortName`\n END),\n `bma_ehr_organization_demo`.`posMaster`.`posMasterNo`) AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirectorChild`,\n `posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n CONCAT(`posMasterChild`.`id`,\n `profileChild`.`id`) AS `key`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n (((((((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgRoot` `orgRootChild` ON ((`posMasterChild`.`orgRootId` = `orgRootChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild1` `orgChild1Child` ON ((`posMasterChild`.`orgChild1Id` = `orgChild1Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild2` `orgChild2Child` ON ((`posMasterChild`.`orgChild2Id` = `orgChild2Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild3` `orgChild3Child` ON ((`posMasterChild`.`orgChild3Id` = `orgChild3Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild4` `orgChild4Child` ON ((`posMasterChild`.`orgChild4Id` = `orgChild4Child`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
await queryRunner.query(`CREATE VIEW \`view_director\` AS SELECT
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`Id\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\` AS \`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\` AS \`firstName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\` AS \`lastName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`citizenId\` AS \`citizenId\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`position\` AS \`position\`,
CONCAT((CASE
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgRoot\`.\`orgRootShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild1\`.\`orgChild1ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild2\`.\`orgChild2ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild3\`.\`orgChild3ShortName\`
ELSE \`bma_ehr_organization_demo\`.\`orgChild4\`.\`orgChild4ShortName\`
END),
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
CONCAT(\`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`id\`) AS \`key\`,
NULL AS \`actFullNameId\`,
NULL AS \`actFullName\`
FROM
((((((((\`bma_ehr_organization_demo\`.\`posMaster\`
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` = \`bma_ehr_organization_demo\`.\`orgRoot\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` = \`bma_ehr_organization_demo\`.\`orgChild1\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` = \`bma_ehr_organization_demo\`.\`orgChild2\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` = \`bma_ehr_organization_demo\`.\`orgChild3\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` = \`bma_ehr_organization_demo\`.\`orgChild4\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n CONCAT((CASE\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgRoot`.`orgRootShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild1`.`orgChild1ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild2`.`orgChild2ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild3`.`orgChild3ShortName`\n ELSE `bma_ehr_organization_demo`.`orgChild4`.`orgChild4ShortName`\n END),\n `bma_ehr_organization_demo`.`posMaster`.`posMasterNo`) AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n CONCAT(`bma_ehr_organization_demo`.`posMaster`.`id`,\n `bma_ehr_organization_demo`.`profile`.`id`) AS `key`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n ((((((((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgRoot` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgRootId` = `bma_ehr_organization_demo`.`orgRoot`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild1` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` = `bma_ehr_organization_demo`.`orgChild1`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild2` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` = `bma_ehr_organization_demo`.`orgChild2`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild3` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` = `bma_ehr_organization_demo`.`orgChild3`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild4` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` = `bma_ehr_organization_demo`.`orgChild4`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_director\``);
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_director_acting\``);
}
}

View file

@ -1,91 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableAppointDirectorAddPosNo31730947807718 implements MigrationInterface {
name = 'UpdateTableAppointDirectorAddPosNo31730947807718'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS SELECT
\`profileChild\`.\`id\` AS \`Id\`,
\`profileChild\`.\`prefix\` AS \`prefix\`,
\`profileChild\`.\`firstName\` AS \`firstName\`,
\`profileChild\`.\`lastName\` AS \`lastName\`,
\`profileChild\`.\`citizenId\` AS \`citizenId\`,
\`profileChild\`.\`position\` AS \`position\`,
CONCAT((CASE
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`orgRootChild\`.\`orgRootShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`orgChild1Child\`.\`orgChild1ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`orgChild2Child\`.\`orgChild2ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`orgChild3Child\`.\`orgChild3ShortName\`
ELSE \`orgChild4Child\`.\`orgChild4ShortName\`
END),
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
\`posMasterChild\`.\`isDirector\` AS \`isDirectorChild\`,
\`posMaster\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
CONCAT(\`posMaster\`.\`id\`,
\`profileChild\`.\`id\`) AS \`key\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
' ',
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\`) AS \`actFullName\`
FROM
(((((((((((\`bma_ehr_organization_demo\`.\`posMasterAct\`
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` \`posMasterChild\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` \`orgRootChild\` ON ((\`posMasterChild\`.\`orgRootId\` = \`orgRootChild\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` \`orgChild1Child\` ON ((\`posMasterChild\`.\`orgChild1Id\` = \`orgChild1Child\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` \`orgChild2Child\` ON ((\`posMasterChild\`.\`orgChild2Id\` = \`orgChild2Child\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` \`orgChild3Child\` ON ((\`posMasterChild\`.\`orgChild3Id\` = \`orgChild3Child\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` \`orgChild4Child\` ON ((\`posMasterChild\`.\`orgChild4Id\` = \`orgChild4Child\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`profileChild\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`profileChild\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posMaster\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterId\` = \`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n CONCAT((CASE\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` IS NULL) THEN `orgRootChild`.`orgRootShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` IS NULL) THEN `orgChild1Child`.`orgChild1ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` IS NULL) THEN `orgChild2Child`.`orgChild2ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` IS NULL) THEN `orgChild3Child`.`orgChild3ShortName`\n ELSE `orgChild4Child`.`orgChild4ShortName`\n END),\n `bma_ehr_organization_demo`.`posMaster`.`posMasterNo`) AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirectorChild`,\n `posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n CONCAT(`posMaster`.`id`,\n `profileChild`.`id`) AS `key`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n (((((((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgRoot` `orgRootChild` ON ((`posMasterChild`.`orgRootId` = `orgRootChild`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild1` `orgChild1Child` ON ((`posMasterChild`.`orgChild1Id` = `orgChild1Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild2` `orgChild2Child` ON ((`posMasterChild`.`orgChild2Id` = `orgChild2Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild3` `orgChild3Child` ON ((`posMasterChild`.`orgChild3Id` = `orgChild3Child`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild4` `orgChild4Child` ON ((`posMasterChild`.`orgChild4Id` = `orgChild4Child`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
await queryRunner.query(`CREATE VIEW \`view_director\` AS SELECT
\`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`Id\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\` AS \`prefix\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`firstName\` AS \`firstName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`lastName\` AS \`lastName\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`citizenId\` AS \`citizenId\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`position\` AS \`position\`,
CONCAT((CASE
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgRoot\`.\`orgRootShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild1\`.\`orgChild1ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild2\`.\`orgChild2ShortName\`
WHEN (\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` IS NULL) THEN \`bma_ehr_organization_demo\`.\`orgChild3\`.\`orgChild3ShortName\`
ELSE \`bma_ehr_organization_demo\`.\`orgChild4\`.\`orgChild4ShortName\`
END),
\`bma_ehr_organization_demo\`.\`posMaster\`.\`posMasterNo\`) AS \`posNo\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`isDirector\` AS \`isDirector\`,
\`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
\`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
CONCAT(\`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`,
\`bma_ehr_organization_demo\`.\`profile\`.\`id\`) AS \`key\`,
NULL AS \`actFullNameId\`,
NULL AS \`actFullName\`
FROM
((((((((\`bma_ehr_organization_demo\`.\`posMaster\`
JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgRoot\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` = \`bma_ehr_organization_demo\`.\`orgRoot\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild1\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild1Id\` = \`bma_ehr_organization_demo\`.\`orgChild1\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild2\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild2Id\` = \`bma_ehr_organization_demo\`.\`orgChild2\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild3\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild3Id\` = \`bma_ehr_organization_demo\`.\`orgChild3\`.\`id\`)))
LEFT JOIN \`bma_ehr_organization_demo\`.\`orgChild4\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`orgChild4Id\` = \`bma_ehr_organization_demo\`.\`orgChild4\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))`);
await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n CONCAT((CASE\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgRoot`.`orgRootShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild1`.`orgChild1ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild2`.`orgChild2ShortName`\n WHEN (`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` IS NULL) THEN `bma_ehr_organization_demo`.`orgChild3`.`orgChild3ShortName`\n ELSE `bma_ehr_organization_demo`.`orgChild4`.`orgChild4ShortName`\n END),\n `bma_ehr_organization_demo`.`posMaster`.`posMasterNo`) AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n CONCAT(`bma_ehr_organization_demo`.`posMaster`.`id`,\n `bma_ehr_organization_demo`.`profile`.`id`) AS `key`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n ((((((((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgRoot` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgRootId` = `bma_ehr_organization_demo`.`orgRoot`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild1` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild1Id` = `bma_ehr_organization_demo`.`orgChild1`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild2` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild2Id` = `bma_ehr_organization_demo`.`orgChild2`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild3` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild3Id` = `bma_ehr_organization_demo`.`orgChild3`.`id`)))\n LEFT JOIN `bma_ehr_organization_demo`.`orgChild4` ON ((`bma_ehr_organization_demo`.`posMaster`.`orgChild4Id` = `bma_ehr_organization_demo`.`orgChild4`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_director\``);
await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
await queryRunner.query(`DROP VIEW \`view_director_acting\``);
}
}

View file

@ -1,244 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableProfilefamAddMotherLastNameOld1730950041973 implements MigrationInterface {
name = 'UpdateTableProfilefamAddMotherLastNameOld1730950041973'
public async up(queryRunner: QueryRunner): Promise<void> {
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
// await queryRunner.query(`DROP VIEW \`view_director_acting\``);
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
// await queryRunner.query(`DROP VIEW \`view_director\``);
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
// await queryRunner.query(`DROP VIEW \`view_director_acting\``);
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
// await queryRunner.query(`DROP VIEW \`view_director\``);
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
// await queryRunner.query(`DROP VIEW \`view_director_acting\``);
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
// await queryRunner.query(`DROP VIEW \`view_director\``);
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
// await queryRunner.query(`DROP VIEW \`view_director_acting\``);
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director","bma_ehr_organization_demo"]);
// await queryRunner.query(`DROP VIEW \`view_director\``);
// await queryRunner.query(`DELETE FROM \`bma_ehr_organization_demo\`.\`typeorm_metadata\` WHERE \`type\` = ? AND \`name\` = ? AND \`schema\` = ?`, ["VIEW","view_director_acting","bma_ehr_organization_demo"]);
// await queryRunner.query(`DROP VIEW \`view_director_acting\``);
await queryRunner.query(`ALTER TABLE \`profileFamilyMotherHistory\` ADD \`motherLastNameOld\` varchar(255) NULL COMMENT 'นามสกุลมารดาเดิม'`);
await queryRunner.query(`ALTER TABLE \`profileFamilyMother\` ADD \`motherLastNameOld\` varchar(255) NULL COMMENT 'นามสกุลมารดาเดิม'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileFamilyMother\` DROP COLUMN \`motherLastNameOld\``);
await queryRunner.query(`ALTER TABLE \`profileFamilyMotherHistory\` DROP COLUMN \`motherLastNameOld\``);
// await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS SELECT
// \`profileChild\`.\`id\` AS \`Id\`,
// \`profileChild\`.\`prefix\` AS \`prefix\`,
// \`profileChild\`.\`firstName\` AS \`firstName\`,
// \`profileChild\`.\`lastName\` AS \`lastName\`,
// \`profileChild\`.\`citizenId\` AS \`citizenId\`,
// \`profileChild\`.\`position\` AS \`position\`,
// NULL AS \`posNo\`,
// \`posMasterChild\`.\`isDirector\` AS \`isDirector\`,
// \`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
// \`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
// \`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
// CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
// ' ',
// \`bma_ehr_organization_demo\`.\`profile\`.\`lastName\`) AS \`actFullName\`
// FROM
// ((((((\`bma_ehr_organization_demo\`.\`posMasterAct\`
// JOIN \`bma_ehr_organization_demo\`.\`posMaster\` \`posMasterChild\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`profileChild\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`profileChild\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posMaster\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterId\` = \`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))`);
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n NULL AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n ((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
// await queryRunner.query(`CREATE VIEW \`view_director\` AS SELECT
// \`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`Id\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`prefix\` AS \`prefix\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`firstName\` AS \`firstName\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`lastName\` AS \`lastName\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`citizenId\` AS \`citizenId\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`position\` AS \`position\`,
// NULL AS \`posNo\`,
// \`bma_ehr_organization_demo\`.\`posMaster\`.\`isDirector\` AS \`isDirector\`,
// \`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
// \`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
// \`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
// NULL AS \`actFullNameId\`,
// NULL AS \`actFullName\`
// FROM
// (((\`bma_ehr_organization_demo\`.\`posMaster\`
// JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))`);
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n NULL AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n (((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
// await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS SELECT
// \`profileChild\`.\`id\` AS \`Id\`,
// \`profileChild\`.\`prefix\` AS \`prefix\`,
// \`profileChild\`.\`firstName\` AS \`firstName\`,
// \`profileChild\`.\`lastName\` AS \`lastName\`,
// \`profileChild\`.\`citizenId\` AS \`citizenId\`,
// \`profileChild\`.\`position\` AS \`position\`,
// NULL AS \`posNo\`,
// \`posMasterChild\`.\`isDirector\` AS \`isDirector\`,
// \`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
// \`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
// \`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
// CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
// ' ',
// \`bma_ehr_organization_demo\`.\`profile\`.\`lastName\`) AS \`actFullName\`
// FROM
// ((((((\`bma_ehr_organization_demo\`.\`posMasterAct\`
// JOIN \`bma_ehr_organization_demo\`.\`posMaster\` \`posMasterChild\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`profileChild\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`profileChild\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posMaster\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterId\` = \`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))`);
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n NULL AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n ((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
// await queryRunner.query(`CREATE VIEW \`view_director\` AS SELECT
// \`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`Id\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`prefix\` AS \`prefix\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`firstName\` AS \`firstName\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`lastName\` AS \`lastName\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`citizenId\` AS \`citizenId\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`position\` AS \`position\`,
// NULL AS \`posNo\`,
// \`bma_ehr_organization_demo\`.\`posMaster\`.\`isDirector\` AS \`isDirector\`,
// \`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
// \`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
// \`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
// NULL AS \`actFullNameId\`,
// NULL AS \`actFullName\`
// FROM
// (((\`bma_ehr_organization_demo\`.\`posMaster\`
// JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))`);
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n NULL AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n (((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
// await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS SELECT
// \`profileChild\`.\`id\` AS \`Id\`,
// \`profileChild\`.\`prefix\` AS \`prefix\`,
// \`profileChild\`.\`firstName\` AS \`firstName\`,
// \`profileChild\`.\`lastName\` AS \`lastName\`,
// \`profileChild\`.\`citizenId\` AS \`citizenId\`,
// \`profileChild\`.\`position\` AS \`position\`,
// NULL AS \`posNo\`,
// \`posMasterChild\`.\`isDirector\` AS \`isDirector\`,
// \`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
// \`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
// \`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
// CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
// ' ',
// \`bma_ehr_organization_demo\`.\`profile\`.\`lastName\`) AS \`actFullName\`
// FROM
// ((((((\`bma_ehr_organization_demo\`.\`posMasterAct\`
// JOIN \`bma_ehr_organization_demo\`.\`posMaster\` \`posMasterChild\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`profileChild\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`profileChild\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posMaster\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterId\` = \`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))`);
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n NULL AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n ((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
// await queryRunner.query(`CREATE VIEW \`view_director\` AS SELECT
// \`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`Id\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`prefix\` AS \`prefix\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`firstName\` AS \`firstName\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`lastName\` AS \`lastName\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`citizenId\` AS \`citizenId\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`position\` AS \`position\`,
// NULL AS \`posNo\`,
// \`bma_ehr_organization_demo\`.\`posMaster\`.\`isDirector\` AS \`isDirector\`,
// \`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
// \`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
// \`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
// NULL AS \`actFullNameId\`,
// NULL AS \`actFullName\`
// FROM
// (((\`bma_ehr_organization_demo\`.\`posMaster\`
// JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))`);
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n NULL AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n (((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
// await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS SELECT
// \`profileChild\`.\`id\` AS \`Id\`,
// \`profileChild\`.\`prefix\` AS \`prefix\`,
// \`profileChild\`.\`firstName\` AS \`firstName\`,
// \`profileChild\`.\`lastName\` AS \`lastName\`,
// \`profileChild\`.\`citizenId\` AS \`citizenId\`,
// \`profileChild\`.\`position\` AS \`position\`,
// NULL AS \`posNo\`,
// \`posMasterChild\`.\`isDirector\` AS \`isDirector\`,
// \`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
// \`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
// \`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
// CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
// ' ',
// \`bma_ehr_organization_demo\`.\`profile\`.\`lastName\`) AS \`actFullName\`
// FROM
// ((((((\`bma_ehr_organization_demo\`.\`posMasterAct\`
// JOIN \`bma_ehr_organization_demo\`.\`posMaster\` \`posMasterChild\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`profileChild\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`profileChild\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posMaster\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterId\` = \`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))`);
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n NULL AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n ((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
// await queryRunner.query(`CREATE VIEW \`view_director\` AS SELECT
// \`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`Id\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`prefix\` AS \`prefix\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`firstName\` AS \`firstName\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`lastName\` AS \`lastName\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`citizenId\` AS \`citizenId\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`position\` AS \`position\`,
// NULL AS \`posNo\`,
// \`bma_ehr_organization_demo\`.\`posMaster\`.\`isDirector\` AS \`isDirector\`,
// \`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
// \`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
// \`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
// NULL AS \`actFullNameId\`,
// NULL AS \`actFullName\`
// FROM
// (((\`bma_ehr_organization_demo\`.\`posMaster\`
// JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`bma_ehr_organization_demo\`.\`profile\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))`);
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director","SELECT \n `bma_ehr_organization_demo`.`profile`.`id` AS `Id`,\n `bma_ehr_organization_demo`.`profile`.`prefix` AS `prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName` AS `firstName`,\n `bma_ehr_organization_demo`.`profile`.`lastName` AS `lastName`,\n `bma_ehr_organization_demo`.`profile`.`citizenId` AS `citizenId`,\n `bma_ehr_organization_demo`.`profile`.`position` AS `position`,\n NULL AS `posNo`,\n `bma_ehr_organization_demo`.`posMaster`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n NULL AS `actFullNameId`,\n NULL AS `actFullName`\n FROM\n (((`bma_ehr_organization_demo`.`posMaster`\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`bma_ehr_organization_demo`.`profile`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`bma_ehr_organization_demo`.`profile`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))"]);
// await queryRunner.query(`CREATE VIEW \`view_director_acting\` AS SELECT
// \`profileChild\`.\`id\` AS \`Id\`,
// \`profileChild\`.\`prefix\` AS \`prefix\`,
// \`profileChild\`.\`firstName\` AS \`firstName\`,
// \`profileChild\`.\`lastName\` AS \`lastName\`,
// \`profileChild\`.\`citizenId\` AS \`citizenId\`,
// \`profileChild\`.\`position\` AS \`position\`,
// NULL AS \`posNo\`,
// \`posMasterChild\`.\`isDirector\` AS \`isDirector\`,
// \`bma_ehr_organization_demo\`.\`posLevel\`.\`posLevelName\` AS \`posLevel\`,
// \`bma_ehr_organization_demo\`.\`posType\`.\`posTypeName\` AS \`posType\`,
// \`bma_ehr_organization_demo\`.\`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`id\` AS \`actFullNameId\`,
// CONCAT(\`bma_ehr_organization_demo\`.\`profile\`.\`prefix\`,
// \`bma_ehr_organization_demo\`.\`profile\`.\`firstName\`,
// ' ',
// \`bma_ehr_organization_demo\`.\`profile\`.\`lastName\`) AS \`actFullName\`
// FROM
// ((((((\`bma_ehr_organization_demo\`.\`posMasterAct\`
// JOIN \`bma_ehr_organization_demo\`.\`posMaster\` \`posMasterChild\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterChildId\` = \`posMasterChild\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`profile\` \`profileChild\` ON ((\`posMasterChild\`.\`current_holderId\` = \`profileChild\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posLevel\` ON ((\`profileChild\`.\`posLevelId\` = \`bma_ehr_organization_demo\`.\`posLevel\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posType\` ON ((\`profileChild\`.\`posTypeId\` = \`bma_ehr_organization_demo\`.\`posType\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`posMaster\` ON ((\`bma_ehr_organization_demo\`.\`posMasterAct\`.\`posMasterId\` = \`bma_ehr_organization_demo\`.\`posMaster\`.\`id\`)))
// JOIN \`bma_ehr_organization_demo\`.\`profile\` ON ((\`bma_ehr_organization_demo\`.\`posMaster\`.\`current_holderId\` = \`bma_ehr_organization_demo\`.\`profile\`.\`id\`)))`);
// await queryRunner.query(`INSERT INTO \`bma_ehr_organization_demo\`.\`typeorm_metadata\`(\`database\`, \`schema\`, \`table\`, \`type\`, \`name\`, \`value\`) VALUES (DEFAULT, ?, DEFAULT, ?, ?, ?)`, ["bma_ehr_organization_demo","VIEW","view_director_acting","SELECT \n `profileChild`.`id` AS `Id`,\n `profileChild`.`prefix` AS `prefix`,\n `profileChild`.`firstName` AS `firstName`,\n `profileChild`.`lastName` AS `lastName`,\n `profileChild`.`citizenId` AS `citizenId`,\n `profileChild`.`position` AS `position`,\n NULL AS `posNo`,\n `posMasterChild`.`isDirector` AS `isDirector`,\n `bma_ehr_organization_demo`.`posLevel`.`posLevelName` AS `posLevel`,\n `bma_ehr_organization_demo`.`posType`.`posTypeName` AS `posType`,\n `bma_ehr_organization_demo`.`posMaster`.`orgRootId` AS `orgRootId`,\n `bma_ehr_organization_demo`.`profile`.`id` AS `actFullNameId`,\n CONCAT(`bma_ehr_organization_demo`.`profile`.`prefix`,\n `bma_ehr_organization_demo`.`profile`.`firstName`,\n ' ',\n `bma_ehr_organization_demo`.`profile`.`lastName`) AS `actFullName`\n FROM\n ((((((`bma_ehr_organization_demo`.`posMasterAct`\n JOIN `bma_ehr_organization_demo`.`posMaster` `posMasterChild` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterChildId` = `posMasterChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` `profileChild` ON ((`posMasterChild`.`current_holderId` = `profileChild`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posLevel` ON ((`profileChild`.`posLevelId` = `bma_ehr_organization_demo`.`posLevel`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posType` ON ((`profileChild`.`posTypeId` = `bma_ehr_organization_demo`.`posType`.`id`)))\n JOIN `bma_ehr_organization_demo`.`posMaster` ON ((`bma_ehr_organization_demo`.`posMasterAct`.`posMasterId` = `bma_ehr_organization_demo`.`posMaster`.`id`)))\n JOIN `bma_ehr_organization_demo`.`profile` ON ((`bma_ehr_organization_demo`.`posMaster`.`current_holderId` = `bma_ehr_organization_demo`.`profile`.`id`)))"]);
}
}

Some files were not shown because too many files have changed in this diff Show more