feat: complete remaining Go backend modules

This commit is contained in:
zn-admin committed 2026-08-14 00:02:43 +08:00
1 parent cea2751dc5
commit aef5a97165
145 files changed
+18376 -199

No files matched your search

+26 -7
View File
@@ -8,6 +8,8 @@ const schemaPaths = [
"../supabase/schema.sql"
];
const lifecycleMigrationPath = "../database/migrations/0002_generation_lifecycle_fencing.sql";
function readSchema(relativePath: string): string {
return readFileSync(fileURLToPath(new URL(relativePath, import.meta.url)), "utf8").replace(/\r\n/g, "\n");
}
@@ -47,12 +49,29 @@ describe.each(schemaPaths)("wallet SQL contract: %s", (schemaPath) => {
});
});
it("keeps the migration and Supabase compatibility snapshot synchronized", () => {
const migration = readSchema(schemaPaths[0]);
const snapshot = readSchema(schemaPaths[1]).replace(
/^-- Compatibility snapshot for existing Supabase deployments\.\r?\n-- New PostgreSQL\/RDS deployments must use `npm run db:migrate`; do not use this\r?\n-- file as an unversioned migration source\.\r?\n\r?\n/,
""
);
it("keeps the Supabase compatibility snapshot at the latest migrated schema", () => {
const baseline = readSchema(schemaPaths[0]);
const lifecycle = readSchema(lifecycleMigrationPath);
const snapshot = readSchema(schemaPaths[1]);
expect(snapshot).toBe(migration);
for (const fragment of [
"provider_dispatch_started_at timestamptz",
"dispatch_ready_at timestamptz",
"finalized_at timestamptz",
"generation_jobs_finalize_claim_idx",
"where dispatch_ready_at is not null",
"and finalized_at is null"
]) {
expect(lifecycle.toLowerCase()).toContain(fragment);
expect(snapshot.toLowerCase()).toContain(fragment);
}
for (const fragment of [
"create table if not exists assets",
"create table if not exists billing_ledger",
"billing_post_wallet_entry"
]) {
expect(baseline.toLowerCase()).toContain(fragment);
expect(snapshot.toLowerCase()).toContain(fragment);
}
expect(snapshot).toContain("Compatibility snapshot for existing Supabase deployments");
});