migrate
This commit is contained in:
parent
693afa4e5f
commit
eb739bfaec
1 changed files with 18 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateTablePosmasterAddRoleๅ1718264530424 implements MigrationInterface {
|
||||||
|
name = 'UpdateTablePosmasterAddRoleๅ1718264530424'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD UNIQUE INDEX \`IDX_a059796d095e79ba5b20407859\` (\`authRoleId\`)`);
|
||||||
|
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_a059796d095e79ba5b20407859\` ON \`posMaster\` (\`authRoleId\`)`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_a059796d095e79ba5b20407859f\` FOREIGN KEY (\`authRoleId\`) REFERENCES \`authRole\`(\`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_a059796d095e79ba5b20407859f\``);
|
||||||
|
await queryRunner.query(`DROP INDEX \`REL_a059796d095e79ba5b20407859\` ON \`posMaster\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP INDEX \`IDX_a059796d095e79ba5b20407859\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue