mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-28 21:58:15 +02:00
add .editorconfig and fix db imports in scripts
This commit is contained in:
parent
2970088b29
commit
a67463a518
3 changed files with 182 additions and 106 deletions
|
@ -1,27 +1,15 @@
|
|||
import { drizzle } from 'drizzle-orm/better-sqlite3';
|
||||
import { migrate } from 'drizzle-orm/better-sqlite3/migrator';
|
||||
import Database from 'better-sqlite3';
|
||||
import { migrate } from "drizzle-orm/better-sqlite3/migrator";
|
||||
import db from "@server/db";
|
||||
|
||||
const runMigrations = async () => {
|
||||
// Create a new SQLite database connection
|
||||
const sqlite = new Database('./config/db/db.sqlite');
|
||||
|
||||
// Create a Drizzle instance
|
||||
const db = drizzle(sqlite);
|
||||
|
||||
console.log('Running migrations...');
|
||||
|
||||
try {
|
||||
// Run the migrations
|
||||
await migrate(db, { migrationsFolder: './server/migrations' });
|
||||
console.log('Migrations completed successfully.');
|
||||
} catch (error) {
|
||||
console.error('Error running migrations:', error);
|
||||
process.exit(1);
|
||||
} finally {
|
||||
// Close the database connection
|
||||
sqlite.close();
|
||||
}
|
||||
console.log("Running migrations...");
|
||||
try {
|
||||
migrate(db, { migrationsFolder: "./server/migrations" });
|
||||
console.log("Migrations completed successfully.");
|
||||
} catch (error) {
|
||||
console.error("Error running migrations:", error);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
runMigrations();
|
||||
runMigrations();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue