"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.up = up;
exports.down = down;
const kysely_1 = require("kysely");
async function up(db) {
    await (0, kysely_1.sql) `CREATE TABLE "integrity_report" (
  "id" uuid NOT NULL DEFAULT immich_uuid_v7(),
  "type" character varying NOT NULL,
  "path" character varying NOT NULL,
  "createdAt" timestamp with time zone NOT NULL DEFAULT now(),
  "assetId" uuid,
  "fileAssetId" uuid,
  CONSTRAINT "integrity_report_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES "asset" ("id") ON UPDATE CASCADE ON DELETE CASCADE,
  CONSTRAINT "integrity_report_fileAssetId_fkey" FOREIGN KEY ("fileAssetId") REFERENCES "asset_file" ("id") ON UPDATE CASCADE ON DELETE CASCADE,
  CONSTRAINT "integrity_report_type_path_uq" UNIQUE ("type", "path"),
  CONSTRAINT "integrity_report_pkey" PRIMARY KEY ("id")
);`.execute(db);
    await (0, kysely_1.sql) `CREATE INDEX "integrity_report_assetId_idx" ON "integrity_report" ("assetId");`.execute(db);
    await (0, kysely_1.sql) `CREATE INDEX "integrity_report_fileAssetId_idx" ON "integrity_report" ("fileAssetId");`.execute(db);
    await (0, kysely_1.sql) `CREATE INDEX "asset_createdAt_idx" ON "asset" ("createdAt");`.execute(db);
}
async function down(db) {
    await (0, kysely_1.sql) `DROP TABLE "integrity_report";`.execute(db);
    await (0, kysely_1.sql) `DROP INDEX "asset_createdAt_idx";`.execute(db);
}
//# sourceMappingURL=1781089983296-CreateIntegrityReportTable.js.map