mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-01 00:06:38 +00:00
restore migrations and fix rate limit
This commit is contained in:
@@ -22,8 +22,6 @@ import m18 from "./scriptsSqlite/1.2.0";
|
||||
import m19 from "./scriptsSqlite/1.3.0";
|
||||
import m20 from "./scriptsSqlite/1.5.0";
|
||||
import m21 from "./scriptsSqlite/1.6.0";
|
||||
import m22 from "./scriptsSqlite/1.7.0";
|
||||
import m23 from "./scriptsSqlite/1.8.0";
|
||||
|
||||
// THIS CANNOT IMPORT ANYTHING FROM THE SERVER
|
||||
// EXCEPT FOR THE DATABASE AND THE SCHEMA
|
||||
@@ -45,9 +43,7 @@ const migrations = [
|
||||
{ version: "1.2.0", run: m18 },
|
||||
{ version: "1.3.0", run: m19 },
|
||||
{ version: "1.5.0", run: m20 },
|
||||
{ version: "1.6.0", run: m21 },
|
||||
{ version: "1.7.0", run: m22 },
|
||||
{ version: "1.8.0", run: m23 }
|
||||
{ version: "1.6.0", run: m21 }
|
||||
// Add new migrations here as they are created
|
||||
] as const;
|
||||
|
||||
@@ -83,21 +79,17 @@ export async function runMigrations() {
|
||||
try {
|
||||
const appVersion = APP_VERSION;
|
||||
|
||||
// Check if the database file exists and has tables
|
||||
const hasTables = await db.select().from(versionMigrations).limit(1).catch(() => false);
|
||||
|
||||
if (hasTables) {
|
||||
if (exists) {
|
||||
await executeScripts();
|
||||
} else {
|
||||
console.log("Running initial migrations...");
|
||||
console.log("Running migrations...");
|
||||
try {
|
||||
migrate(db, {
|
||||
migrationsFolder: path.join(APP_PATH, "server", "migrations")
|
||||
migrationsFolder: path.join(__DIRNAME, "init") // put here during the docker build
|
||||
});
|
||||
console.log("Initial migrations completed successfully.");
|
||||
console.log("Migrations completed successfully.");
|
||||
} catch (error) {
|
||||
console.error("Error running initial migrations:", error);
|
||||
throw error;
|
||||
console.error("Error running migrations:", error);
|
||||
}
|
||||
|
||||
await db
|
||||
|
||||
Reference in New Issue
Block a user