migration: add field dnaId and profileId
This commit is contained in:
parent
428b995081
commit
7334fd711f
2 changed files with 72 additions and 0 deletions
|
|
@ -98,4 +98,52 @@ export class PosMasterHistory extends EntityBase {
|
|||
default: null,
|
||||
})
|
||||
ancestorDNA: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง profile",
|
||||
default: null,
|
||||
})
|
||||
profileId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "dna ของตาราง orgRoot",
|
||||
default: null,
|
||||
})
|
||||
rootDnaId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "dna ของตาราง orgChild1",
|
||||
default: null,
|
||||
})
|
||||
child1DnaId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "dna ของตาราง orgChild2",
|
||||
default: null,
|
||||
})
|
||||
child2DnaId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "dna ของตาราง orgChild3",
|
||||
default: null,
|
||||
})
|
||||
child3DnaId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "dna ของตาราง orgChild4",
|
||||
default: null,
|
||||
})
|
||||
child4DnaId: string;
|
||||
}
|
||||
|
|
|
|||
24
src/migration/1766760828376-add_field_dnaid_and_prodileid.ts
Normal file
24
src/migration/1766760828376-add_field_dnaid_and_prodileid.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class AddFieldDnaidAndProdileid1766760828376 implements MigrationInterface {
|
||||
name = 'AddFieldDnaidAndProdileid1766760828376'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง profile'`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`rootDnaId\` varchar(40) NULL COMMENT 'dna ของตาราง orgRoot'`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`child1DnaId\` varchar(40) NULL COMMENT 'dna ของตาราง orgChild1'`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`child2DnaId\` varchar(40) NULL COMMENT 'dna ของตาราง orgChild2'`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`child3DnaId\` varchar(40) NULL COMMENT 'dna ของตาราง orgChild3'`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` ADD \`child4DnaId\` varchar(40) NULL COMMENT 'dna ของตาราง orgChild4'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` DROP COLUMN \`child4DnaId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` DROP COLUMN \`child3DnaId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` DROP COLUMN \`child2DnaId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` DROP COLUMN \`child1DnaId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` DROP COLUMN \`rootDnaId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`posMasterHistory\` DROP COLUMN \`profileId\``);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue