no message

This commit is contained in:
Kittapath 2024-01-31 18:02:50 +07:00
parent 923d75ebe3
commit 165d5e6837
2 changed files with 41 additions and 9 deletions

View file

@ -27,10 +27,8 @@ export class PosMaster extends EntityBase {
@Column({
nullable: true,
comment: "เลขที่ตำแหน่ง เป็นตัวเลข",
length: 16,
default: "string",
})
posMasterNo: string;
posMasterNo: number;
@Column({
nullable: true,
@ -168,7 +166,7 @@ export class CreatePosMaster {
posMasterNoPrefix: string;
@Column()
posMasterNo: string;
posMasterNo: number;
@Column()
posMasterNoSuffix: string;
@ -177,19 +175,19 @@ export class CreatePosMaster {
positions: CreatePosDict[];
@Column("uuid")
orgRootId?: string;
orgRootId?: string | null;
@Column("uuid")
orgChild1Id?: string;
orgChild1Id?: string | null;
@Column("uuid")
orgChild2Id?: string;
orgChild2Id?: string | null;
@Column("uuid")
orgChild3Id?: string;
orgChild3Id?: string | null;
@Column("uuid")
orgChild4Id?: string;
orgChild4Id?: string | null;
}
export type UpdatePosMaster = Partial<PosMaster>;

View file

@ -0,0 +1,34 @@
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`);
}
}