"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.runMigrations = runMigrations; const kysely_1 = require("kysely"); const path_1 = __importDefault(require("path")); const promises_1 = __importDefault(require("fs/promises")); async function runMigrations(db) { const migrator = new kysely_1.Migrator({ db, provider: new kysely_1.FileMigrationProvider({ fs: promises_1.default, path: path_1.default, migrationFolder: path_1.default.join(__dirname, 'migrations'), }), }); const { error, results } = await migrator.migrateToLatest(); results?.forEach(result => { if (result.status === 'Success') { console.log(`Migration "${result.migrationName}" executed successfully`); } else if (result.status === 'Error') { console.error(`Migration "${result.migrationName}" failed`); } }); if (error) { throw error; } }