Files
seerr/server/migration/postgres/1747690625482-AddEpisodeTable.ts
0xsysr3ll 037ba75bd4 feat(episodes): add episode availability tracking and sync
This allows Jellyseerr to track the availability status of individual
episodes, enabling better status reporting for partially available seasons.
2026-06-13 14:24:14 +02:00

22 lines
1.1 KiB
TypeScript
Executable File

import type { MigrationInterface, QueryRunner } from 'typeorm';
export class AddEpisodeTable1747690625482 implements MigrationInterface {
name = 'AddEpisodeTable1747690625482';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE "episode" ("id" SERIAL NOT NULL, "episodeNumber" integer NOT NULL, "status" integer NOT NULL DEFAULT '1', "status4k" integer NOT NULL DEFAULT '1', "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "seasonId" integer, CONSTRAINT "PK_7258b95d6d2bf7f621845a0e143" PRIMARY KEY ("id"))`
);
await queryRunner.query(
`ALTER TABLE "episode" ADD CONSTRAINT "FK_e73d28c1e5e3c85125163f7c9cd" FOREIGN KEY ("seasonId") REFERENCES "season"("id") ON DELETE CASCADE ON UPDATE NO ACTION`
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "episode" DROP CONSTRAINT "FK_e73d28c1e5e3c85125163f7c9cd"`
);
await queryRunner.query(`DROP TABLE "episode"`);
}
}