-
-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove non-null requirement for some fields (#1175)
PR #628 changed some fields to disallow null values, causing issues with some older SQLite database having null values. This PR reverts this change.
- Loading branch information
1 parent
59b7859
commit 13d15d1
Showing
5 changed files
with
65 additions
and
382 deletions.
There are no files selected for viewing
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
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
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
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,65 @@ | ||
import type { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class FixNullFields1734809898562 implements MigrationInterface { | ||
name = 'FixNullFields1734809898562'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE "watchlist" DROP CONSTRAINT "FK_6641da8d831b93dfcb429f8b8bc"` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "watchlist" ALTER COLUMN "mediaId" DROP NOT NULL` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "media_request" DROP CONSTRAINT "FK_a1aa713f41c99e9d10c48da75a0"` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "media_request" ALTER COLUMN "mediaId" DROP NOT NULL` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "season" DROP CONSTRAINT "FK_087099b39600be695591da9a49c"` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "season" ALTER COLUMN "mediaId" DROP NOT NULL` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "watchlist" ADD CONSTRAINT "FK_6641da8d831b93dfcb429f8b8bc" FOREIGN KEY ("mediaId") REFERENCES "media"("id") ON DELETE CASCADE ON UPDATE NO ACTION` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "media_request" ADD CONSTRAINT "FK_a1aa713f41c99e9d10c48da75a0" FOREIGN KEY ("mediaId") REFERENCES "media"("id") ON DELETE CASCADE ON UPDATE NO ACTION` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "season" ADD CONSTRAINT "FK_087099b39600be695591da9a49c" FOREIGN KEY ("mediaId") REFERENCES "media"("id") ON DELETE CASCADE ON UPDATE NO ACTION` | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE "season" DROP CONSTRAINT "FK_087099b39600be695591da9a49c"` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "media_request" DROP CONSTRAINT "FK_a1aa713f41c99e9d10c48da75a0"` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "watchlist" DROP CONSTRAINT "FK_6641da8d831b93dfcb429f8b8bc"` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "season" ALTER COLUMN "mediaId" SET NOT NULL` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "season" ADD CONSTRAINT "FK_087099b39600be695591da9a49c" FOREIGN KEY ("mediaId") REFERENCES "media"("id") ON DELETE CASCADE ON UPDATE NO ACTION` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "media_request" ALTER COLUMN "mediaId" SET NOT NULL` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "media_request" ADD CONSTRAINT "FK_a1aa713f41c99e9d10c48da75a0" FOREIGN KEY ("mediaId") REFERENCES "media"("id") ON DELETE CASCADE ON UPDATE NO ACTION` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "watchlist" ALTER COLUMN "mediaId" SET NOT NULL` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "watchlist" ADD CONSTRAINT "FK_6641da8d831b93dfcb429f8b8bc" FOREIGN KEY ("mediaId") REFERENCES "media"("id") ON DELETE CASCADE ON UPDATE NO ACTION` | ||
); | ||
} | ||
} |
Oops, something went wrong.