2024-09-28 17:42:07 -04:00
|
|
|
import { migrate } from "drizzle-orm/better-sqlite3/migrator";
|
|
|
|
import db from "@server/db";
|
2024-09-28 22:50:10 -04:00
|
|
|
import path from "path";
|
2024-09-28 13:31:22 -04:00
|
|
|
|
2024-09-29 15:39:58 -04:00
|
|
|
const migrationsFolder = path.join(__dirname, "../server/migrations");
|
|
|
|
console.log(migrationsFolder);
|
|
|
|
|
|
|
|
|
2024-09-28 13:31:22 -04:00
|
|
|
const runMigrations = async () => {
|
2024-09-28 17:42:07 -04:00
|
|
|
console.log("Running migrations...");
|
|
|
|
try {
|
2024-09-28 22:50:10 -04:00
|
|
|
migrate(db, {
|
2024-09-29 15:39:58 -04:00
|
|
|
migrationsFolder: migrationsFolder,
|
2024-09-28 22:50:10 -04:00
|
|
|
});
|
2024-09-28 17:42:07 -04:00
|
|
|
console.log("Migrations completed successfully.");
|
|
|
|
} catch (error) {
|
|
|
|
console.error("Error running migrations:", error);
|
|
|
|
process.exit(1);
|
|
|
|
}
|
2024-09-28 13:31:22 -04:00
|
|
|
};
|
|
|
|
|
2024-09-28 17:42:07 -04:00
|
|
|
runMigrations();
|