Add scripts and fix routes

This commit is contained in:
Owen Schwartz 2024-09-28 14:46:36 -04:00
parent ac6a6d7616
commit 77d71de990
No known key found for this signature in database
GPG key ID: 8271FDFFD9E0CCBD
6 changed files with 91 additions and 13 deletions

View file

@ -1,27 +0,0 @@
import { drizzle } from 'drizzle-orm/better-sqlite3';
import { migrate } from 'drizzle-orm/better-sqlite3/migrator';
import Database from 'better-sqlite3';
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();
}
};
runMigrations();