fosrl.pangolin/server/db/sqlite/migrate.ts
Adrian Astles ec8d3569d3 fix: resolve build errors and improve database migration system
- Remove unused SQLite migration script 1.8.1.ts that was causing
  TypeScript compilation errors during PostgreSQL builds
- Fix verifyTotp.ts type error by adding proper null check for password
  parameter before passing to verifyPassword function
- Fix SQLite migration script 1.7.0.ts syntax errors in transaction
  structure and error handling
**- Update SQLite migration system to not drop tables by default, as this was used during testing and should not be in production.**

Fixes build failures for both "make build" (SQLite) and "make build-pg"
(PostgreSQL) Docker image builds.
2025-07-15 06:40:31 +08:00

20 lines
547 B
TypeScript

import { migrate } from "drizzle-orm/better-sqlite3/migrator";
import { db } from "./driver";
import path from "path";
const migrationsFolder = path.join("server/migrations");
const runMigrations = async () => {
console.log("Running migrations...");
try {
migrate(db as any, {
migrationsFolder: migrationsFolder,
});
console.log("Migrations completed successfully.");
} catch (error) {
console.error("Error running migrations:", error);
process.exit(1);
}
};
runMigrations();