migrate db
This commit is contained in:
parent
fcbe8e99ef
commit
806fb21c61
1 changed files with 18 additions and 0 deletions
18
src/migration/1710323273630-add_table_profileduty.ts
Normal file
18
src/migration/1710323273630-add_table_profileduty.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
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`);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue