Merge branch 'develop' into adiDev
This commit is contained in:
commit
4bd16513de
4 changed files with 32 additions and 20 deletions
|
|
@ -173,6 +173,8 @@ export class EmployeePosMaster extends EntityBase {
|
|||
orgRevisionId: string; //fk
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง authRole",
|
||||
})
|
||||
|
|
|
|||
|
|
@ -172,6 +172,8 @@ export class PosMaster extends EntityBase {
|
|||
orgRevisionId: string; //fk
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
default: null,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง authRole",
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateTablePosmasterAddRole1718263333866 implements MigrationInterface {
|
||||
name = 'UpdateTablePosmasterAddRole1718263333866'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`authRoleId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง authRole'`);
|
||||
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\``);
|
||||
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`authRoleId\``);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateTablePosmasterAddRole11718266321698 implements MigrationInterface {
|
||||
name = 'UpdateTablePosmasterAddRole11718266321698'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` CHANGE \`authRoleId\` \`authRoleId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง authRole'`);
|
||||
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD UNIQUE INDEX \`IDX_388ecc9f2a9f5b5ff1e08fd6d0\` (\`authRoleId\`)`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`authRoleId\` \`authRoleId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง authRole'`);
|
||||
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD UNIQUE INDEX \`IDX_a059796d095e79ba5b20407859\` (\`authRoleId\`)`);
|
||||
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_388ecc9f2a9f5b5ff1e08fd6d0\` ON \`employeePosMaster\` (\`authRoleId\`)`);
|
||||
await queryRunner.query(`CREATE UNIQUE INDEX \`REL_a059796d095e79ba5b20407859\` ON \`posMaster\` (\`authRoleId\`)`);
|
||||
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD CONSTRAINT \`FK_388ecc9f2a9f5b5ff1e08fd6d0e\` FOREIGN KEY (\`authRoleId\`) REFERENCES \`authRole\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
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(`ALTER TABLE \`employeePosMaster\` DROP FOREIGN KEY \`FK_388ecc9f2a9f5b5ff1e08fd6d0e\``);
|
||||
await queryRunner.query(`DROP INDEX \`REL_a059796d095e79ba5b20407859\` ON \`posMaster\``);
|
||||
await queryRunner.query(`DROP INDEX \`REL_388ecc9f2a9f5b5ff1e08fd6d0\` ON \`employeePosMaster\``);
|
||||
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP INDEX \`IDX_a059796d095e79ba5b20407859\``);
|
||||
await queryRunner.query(`ALTER TABLE \`posMaster\` CHANGE \`authRoleId\` \`authRoleId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง authRole'`);
|
||||
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP INDEX \`IDX_388ecc9f2a9f5b5ff1e08fd6d0\``);
|
||||
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` CHANGE \`authRoleId\` \`authRoleId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง authRole'`);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue