"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) `
    INSERT INTO "asset_file" ("assetId", "type", "path")
    SELECT "id", 'encoded_video', "encodedVideoPath"
    FROM "asset"
    WHERE "encodedVideoPath" IS NOT NULL AND "encodedVideoPath" != '';
  `.execute(db);
    await (0, kysely_1.sql) `ALTER TABLE "asset" DROP COLUMN "encodedVideoPath";`.execute(db);
}
async function down(db) {
    await (0, kysely_1.sql) `ALTER TABLE "asset" ADD "encodedVideoPath" character varying DEFAULT '';`.execute(db);
    await (0, kysely_1.sql) `
    UPDATE "asset"
    SET "encodedVideoPath" = af."path"
    FROM "asset_file" af
    WHERE "asset"."id" = af."assetId"
      AND af."type" = 'encoded_video'
      AND af."isEdited" = false;
  `.execute(db);
}
//# sourceMappingURL=1773242919341-EncodedVideoAssetFiles.js.map