This commit is contained in:
AnandaTon 2024-05-16 14:11:18 +07:00
commit 42bad7b302
2 changed files with 20 additions and 0 deletions

View file

@ -16,9 +16,11 @@ import { ProfileSalaryHistory } from "./ProfileSalaryHistory";
@Entity("profileSalary")
export class ProfileSalary extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง profile",
type: "uuid",
default: null,
})
profileId: string;

View file

@ -0,0 +1,18 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableProfileAvatarAddIsactive31715843317765 implements MigrationInterface {
name = 'UpdateTableProfileAvatarAddIsactive31715843317765'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP FOREIGN KEY \`FK_7534d36579c78107ba08a96be6f\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` CHANGE \`profileId\` \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง profile'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD CONSTRAINT \`FK_7534d36579c78107ba08a96be6f\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP FOREIGN KEY \`FK_7534d36579c78107ba08a96be6f\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` CHANGE \`profileId\` \`profileId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง profile'`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD CONSTRAINT \`FK_7534d36579c78107ba08a96be6f\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}