fix(forms): surface validation and recover schema drift
Quality / quality (ubuntu-latest) (push) Failing after 10m23s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-15 13:01:10 +05:30
parent 1d16ef1e82
commit d78707be9f
10 changed files with 128 additions and 19 deletions
+18
View File
@@ -161,6 +161,24 @@ test("comment-only migrations are recorded without executing empty SQL", async (
await db.close();
});
test("add-column migrations recover when the column exists but the migration record does not", async () => {
const db = createDb(sqlite());
await db.exec("CREATE TABLE otp_challenges (id TEXT PRIMARY KEY, purpose TEXT NOT NULL)");
const migrations = [
{
name: "0002_otp_purpose",
up: "ALTER TABLE otp_challenges ADD COLUMN purpose TEXT NOT NULL DEFAULT 'verification';",
down: "ALTER TABLE otp_challenges DROP COLUMN purpose;",
},
];
expect(await applyMigrations(db, migrations)).toEqual(["0002_otp_purpose"]);
expect(await appliedMigrations(db)).toContain("0002_otp_purpose");
const columns = await db.all<{ name: string }>("PRAGMA table_info(otp_challenges)");
expect(columns.filter(({ name }) => name === "purpose")).toHaveLength(1);
await db.close();
});
test("migration dry-run plans changes without applying schema and honors cancellation", async () => {
const db = createDb(sqlite());
const migrations = [