Add onDeleteAction to RelationMetadata (#4100)
* Add onDeleteAction to relationMetadata * rename to SET NULL * fix migration * fix migration * fix after review
This commit is contained in:
@ -0,0 +1,25 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddOnDeleteActionToRelationMetadata1708449210922
|
||||
implements MigrationInterface
|
||||
{
|
||||
name = 'AddOnDeleteActionToRelationMetadata1708449210922';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "metadata"."relationMetadata_ondeleteaction_enum" AS ENUM('CASCADE', 'RESTRICT', 'SET_NULL')`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "metadata"."relationMetadata" ADD "onDeleteAction" "metadata"."relationMetadata_ondeleteaction_enum" NOT NULL DEFAULT 'SET_NULL'`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "metadata"."relationMetadata" DROP COLUMN "onDeleteAction"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP TYPE "metadata"."relationMetadata_ondeleteaction_enum"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user