import { migrate as migratePostgres } from "drizzle-orm/node-postgres/migrator"; import { migrate as migratePglite } from "drizzle-orm/pglite/migrator"; import { getDbInstance } from "./db/getInstance"; export async function runMigrations() { if (typeof window !== "undefined") { return; } const { db, type } = getDbInstance(); if (type === "pglite") { await migratePglite(db, { migrationsFolder: "./drizzle" }); } else if (type === "postgres") { await migratePostgres(db, { migrationsFolder: "./drizzle" }); } else { throw new Error(`Unsupported database type: ${type}`); } console.log("Migrations completed successfully."); }