"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AddMediaTypeToUniqueConstraints1772048000333 = void 0;
class AddMediaTypeToUniqueConstraints1772048000333 {
    constructor() {
        this.name = 'AddMediaTypeToUniqueConstraints1772048000333';
    }
    async up(queryRunner) {
        // Manually added: TypeORM migration:generate does not detect changes to named unique constraints.
        await queryRunner.query(`ALTER TABLE "watchlist" DROP CONSTRAINT "UNIQUE_USER_DB"`);
        await queryRunner.query(`ALTER TABLE "watchlist" ADD CONSTRAINT "UNIQUE_USER_DB" UNIQUE ("tmdbId", "mediaType", "requestedById")`);
        // Auto-generated by TypeORM
        await queryRunner.query(`CREATE SEQUENCE IF NOT EXISTS "blocklist_id_seq" OWNED BY "blocklist"."id"`);
        await queryRunner.query(`ALTER TABLE "blocklist" ALTER COLUMN "id" SET DEFAULT nextval('"blocklist_id_seq"')`);
        await queryRunner.query(`ALTER TABLE "blocklist" DROP CONSTRAINT "UQ_6bbafa28411e6046421991ea21c"`);
        await queryRunner.query(`ALTER TABLE "blocklist" ADD CONSTRAINT "UQ_81504e02db89b4c1e3152729fa6" UNIQUE ("tmdbId", "mediaType")`);
    }
    async down(queryRunner) {
        // Manually added: TypeORM migration:generate does not detect changes to named unique constraints.
        await queryRunner.query(`ALTER TABLE "watchlist" DROP CONSTRAINT "UNIQUE_USER_DB"`);
        await queryRunner.query(`ALTER TABLE "watchlist" ADD CONSTRAINT "UNIQUE_USER_DB" UNIQUE ("tmdbId", "requestedById")`);
        // Auto-generated by TypeORM
        await queryRunner.query(`ALTER TABLE "blocklist" DROP CONSTRAINT "UQ_81504e02db89b4c1e3152729fa6"`);
        await queryRunner.query(`ALTER TABLE "blocklist" ADD CONSTRAINT "UQ_6bbafa28411e6046421991ea21c" UNIQUE ("tmdbId")`);
        await queryRunner.query(`ALTER TABLE "blocklist" ALTER COLUMN "id" DROP DEFAULT`);
        await queryRunner.query(`DROP SEQUENCE "blocklist_id_seq"`);
    }
}
exports.AddMediaTypeToUniqueConstraints1772048000333 = AddMediaTypeToUniqueConstraints1772048000333;
