var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import CaptureSpan from "../../../Utils/Telemetry/CaptureSpan";
export class MigrationName1737141420441 {
    constructor() {
        this.name = "MigrationName1737141420441";
    }
    async up(queryRunner) {
        await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" ADD "triggeredByAlertId" uuid`);
        await queryRunner.query(`ALTER TABLE "UserNotificationRule" ADD "alertSeverityId" uuid`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLog" ADD "triggeredByAlertId" uuid`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLogTimeline" ADD "triggeredByAlertId" uuid`);
        await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" DROP CONSTRAINT "FK_90119ec7f77fa2efd82261e0448"`);
        await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" ALTER COLUMN "triggeredByIncidentId" DROP NOT NULL`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLog" DROP CONSTRAINT "FK_eeb0dd05d1dec542c3de5fb5074"`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLog" ALTER COLUMN "triggeredByIncidentId" DROP NOT NULL`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLogTimeline" DROP CONSTRAINT "FK_58a44736718a5ec4fe41526289a"`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLogTimeline" ALTER COLUMN "triggeredByIncidentId" DROP NOT NULL`);
        await queryRunner.query(`CREATE INDEX "IDX_30358ab25e4c6c9ad72e74f201" ON "OnCallDutyPolicyExecutionLogTimeline" ("triggeredByAlertId") `);
        await queryRunner.query(`CREATE INDEX "IDX_d73339f6c26fd6ebd0326badcd" ON "UserNotificationRule" ("alertSeverityId") `);
        await queryRunner.query(`CREATE INDEX "IDX_42d9916277fcbefa0cdd3904c6" ON "UserOnCallLogTimeline" ("triggeredByAlertId") `);
        await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" ADD CONSTRAINT "FK_90119ec7f77fa2efd82261e0448" FOREIGN KEY ("triggeredByIncidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" ADD CONSTRAINT "FK_30358ab25e4c6c9ad72e74f201c" FOREIGN KEY ("triggeredByAlertId") REFERENCES "Alert"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE "UserNotificationRule" ADD CONSTRAINT "FK_d73339f6c26fd6ebd0326badcd7" FOREIGN KEY ("alertSeverityId") REFERENCES "AlertSeverity"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLog" ADD CONSTRAINT "FK_eeb0dd05d1dec542c3de5fb5074" FOREIGN KEY ("triggeredByIncidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLog" ADD CONSTRAINT "FK_0ee3711cdc64957845d9d028c31" FOREIGN KEY ("triggeredByAlertId") REFERENCES "Alert"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLogTimeline" ADD CONSTRAINT "FK_58a44736718a5ec4fe41526289a" FOREIGN KEY ("triggeredByIncidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLogTimeline" ADD CONSTRAINT "FK_42d9916277fcbefa0cdd3904c63" FOREIGN KEY ("triggeredByAlertId") REFERENCES "Alert"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`);
    }
    async down(queryRunner) {
        await queryRunner.query(`ALTER TABLE "UserOnCallLogTimeline" DROP CONSTRAINT "FK_42d9916277fcbefa0cdd3904c63"`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLogTimeline" DROP CONSTRAINT "FK_58a44736718a5ec4fe41526289a"`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLog" DROP CONSTRAINT "FK_0ee3711cdc64957845d9d028c31"`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLog" DROP CONSTRAINT "FK_eeb0dd05d1dec542c3de5fb5074"`);
        await queryRunner.query(`ALTER TABLE "UserNotificationRule" DROP CONSTRAINT "FK_d73339f6c26fd6ebd0326badcd7"`);
        await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" DROP CONSTRAINT "FK_30358ab25e4c6c9ad72e74f201c"`);
        await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" DROP CONSTRAINT "FK_90119ec7f77fa2efd82261e0448"`);
        await queryRunner.query(`DROP INDEX "public"."IDX_42d9916277fcbefa0cdd3904c6"`);
        await queryRunner.query(`DROP INDEX "public"."IDX_d73339f6c26fd6ebd0326badcd"`);
        await queryRunner.query(`DROP INDEX "public"."IDX_30358ab25e4c6c9ad72e74f201"`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLogTimeline" ALTER COLUMN "triggeredByIncidentId" SET NOT NULL`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLogTimeline" ADD CONSTRAINT "FK_58a44736718a5ec4fe41526289a" FOREIGN KEY ("triggeredByIncidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLog" ALTER COLUMN "triggeredByIncidentId" SET NOT NULL`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLog" ADD CONSTRAINT "FK_eeb0dd05d1dec542c3de5fb5074" FOREIGN KEY ("triggeredByIncidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" ALTER COLUMN "triggeredByIncidentId" SET NOT NULL`);
        await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" ADD CONSTRAINT "FK_90119ec7f77fa2efd82261e0448" FOREIGN KEY ("triggeredByIncidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLogTimeline" DROP COLUMN "triggeredByAlertId"`);
        await queryRunner.query(`ALTER TABLE "UserOnCallLog" DROP COLUMN "triggeredByAlertId"`);
        await queryRunner.query(`ALTER TABLE "UserNotificationRule" DROP COLUMN "alertSeverityId"`);
        await queryRunner.query(`ALTER TABLE "OnCallDutyPolicyExecutionLogTimeline" DROP COLUMN "triggeredByAlertId"`);
    }
}
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], MigrationName1737141420441.prototype, "up", null);
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], MigrationName1737141420441.prototype, "down", null);
//# sourceMappingURL=1737141420441-MigrationName.js.map