Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: set not null on the community
- Loading branch information
Showing
2 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
packages/server/api/src/app/database/migration/1709505632771-SetNotNullOnPlatform.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class SetNotNullOnPlatform1709505632771 implements MigrationInterface { | ||
name = 'SetNotNullOnPlatform1709505632771' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
DROP INDEX "public"."idx_project_platform_id_external_id" | ||
`) | ||
await queryRunner.query(` | ||
ALTER TABLE "project" | ||
ALTER COLUMN "platformId" | ||
SET NOT NULL | ||
`) | ||
await queryRunner.query(` | ||
CREATE UNIQUE INDEX "idx_project_platform_id_external_id" ON "project" ("platformId", "externalId") | ||
`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
DROP INDEX "public"."idx_project_platform_id_external_id" | ||
`) | ||
await queryRunner.query(` | ||
ALTER TABLE "project" | ||
ALTER COLUMN "platformId" DROP NOT NULL | ||
`) | ||
await queryRunner.query(` | ||
CREATE UNIQUE INDEX "idx_project_platform_id_external_id" ON "project" ("platformId", "externalId") | ||
`) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters