"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
require("dotenv/config");
const promise_1 = __importDefault(require("mysql2/promise"));
const mysql2_1 = require("drizzle-orm/mysql2");
const migrator_1 = require("drizzle-orm/mysql2/migrator");
const run = async () => {
    const connection = await promise_1.default.createConnection(process.env.DATABASE_URL);
    const db = (0, mysql2_1.drizzle)(connection);
    console.log("Running migrations...");
    await (0, migrator_1.migrate)(db, { migrationsFolder: "./src/db/migrations" });
    console.log("Migrations complete.");
    await connection.end();
    process.exit(0);
};
run().catch((err) => {
    console.error("Migration failed:", err);
    process.exit(1);
});
//# sourceMappingURL=migrate.js.map