Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Accounts 1: the O7 migration test names its migration by what it does

Claude6fb52dbd514d
diff --git a/src/server/db.ts b/src/server/db.ts
index 2b226203..6f90bf00 100644
--- a/src/server/db.ts
+++ b/src/server/db.ts
@@ -716,8 +716,10 @@ const MIGRATIONS: string[] = [
create index "auth_verification_identifier_idx" on "auth_verification" ("identifier");`,
];
+/** The index of the migration whose SQL contains `fragment` (-1 when none does): tests and the bootstrap name migrations by what they do. */
+export const migrationIndexOf = (fragment: string): number => MIGRATIONS.findIndex((sql) => sql.includes(fragment));
/** The migration that creates the identity tables: the bootstrap snapshots an existing database before it runs (src/server/identity/bootstrap.ts). */
-export const IDENTITY_MIGRATION = MIGRATIONS.findIndex((sql) => sql.includes("CREATE TABLE IF NOT EXISTS users ("));
+export const IDENTITY_MIGRATION = migrationIndexOf("CREATE TABLE IF NOT EXISTS users (");
/** How many migrations this build has (a snapshot's manifest records it). */
export const MIGRATION_COUNT = MIGRATIONS.length;
diff --git a/tests/no-higgsfield.test.ts b/tests/no-higgsfield.test.ts
index 05b94d49..f2a11282 100644
--- a/tests/no-higgsfield.test.ts
+++ b/tests/no-higgsfield.test.ts
@@ -26,7 +26,7 @@ const { SOUL_LEGACY_IDS } = await import("@/lib/catalog/soul-looks.generated");
const { PROVIDER_SETTINGS } = await import("@/lib/connections");
const { PROVIDERS, provider, RETIRED_PROVIDER_ERROR } = await import("@/server/providers");
const { SETTINGS, getSetting, setSetting } = await import("@/server/settings");
-const { db } = await import("@/server/db");
+const { db, migrationIndexOf } = await import("@/server/db");
const { withCurrentModels } = await import("@/lib/catalog/canvas");
const generationsRoute = await import("@/app/api/generations/route");
const { currentRequest, ensureRunner, getGeneration, listGenerations, previewGeneration } = await import("@/server/generations");
@@ -538,7 +538,9 @@ describe("stored ids resolve where they are read", () => {
describe("the O7 migration", () => {
it("deletes the retired key, resets the provider choice and marks the ads drawn whole as baked", () => {
const d = db();
- const last = (d.prepare("SELECT MAX(id) AS id FROM _migrations").get() as { id: number }).id;
+ // The O7 migration by what it does (later packages append theirs after it).
+ const last = migrationIndexOf("DELETE FROM settings WHERE key = 'higgsfield.key'");
+ expect(last).toBeGreaterThan(0);
// An install from before: rows the migration rewrites, then the migration runs again on the next open.
d.prepare("INSERT OR REPLACE INTO settings (key, value) VALUES ('higgsfield.key', 'id:secret'), ('cloud.provider', 'higgsfield')").run();
d.prepare("INSERT INTO ad_batches (id, brand_id, engine, route, model_id, created_at) VALUES ('b1', 'br', 'cloud', 'higgsfield', 'ads-studio', 1), ('b2', 'br', 'cloud', 'fuobe', 'nano-banana-pro', 2)").run();