From 5b5a49bcd23a682690c412f6df5da8fdc848d646 Mon Sep 17 00:00:00 2001 From: Gustavo Valverde Date: Mon, 24 Aug 2026 13:09:07 -0400 Subject: [PATCH] test(db): opt issuer migration checks into issuer identity --- .../better-auth/src/db/get-migration.test.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/better-auth/src/db/get-migration.test.ts b/packages/better-auth/src/db/get-migration.test.ts index 7225cd3c3a..17b11b9179 100644 --- a/packages/better-auth/src/db/get-migration.test.ts +++ b/packages/better-auth/src/db/get-migration.test.ts @@ -580,7 +580,10 @@ describe("get-migration: unsafe schema changes on populated tables", () => { */ it("refuses to add the account issuer column to a populated account table, pointing at the upgrade guide", async () => { const failure = await captureFailure( - getMigrations({ database: createAccountDb({}) }), + getMigrations({ + account: { identityStrategy: "issuer" }, + database: createAccountDb({}), + }), ); expect(failure).toBeInstanceOf(BetterAuthError); @@ -594,7 +597,10 @@ describe("get-migration: unsafe schema changes on populated tables", () => { const failure = await captureFailure( getMigrations({ database: createAccountDb({ issuerColumn: "identity_issuer" }), - account: { fields: { issuer: "identity_issuer" } }, + account: { + identityStrategy: "issuer", + fields: { issuer: "identity_issuer" }, + }, }), ); @@ -606,6 +612,7 @@ describe("get-migration: unsafe schema changes on populated tables", () => { it("plans a required column without a default when the table is empty", async () => { const { compileMigrations, toBeAdded } = await getMigrations({ + account: { identityStrategy: "issuer" }, database: createAccountDb({ seeded: false }), }); @@ -704,6 +711,7 @@ describe("get-migration: nullable columns for required fields", () => { it("accepts a required field whose live column is not null", async () => { const { compileMigrations, toBeAdded } = await getMigrations({ + account: { identityStrategy: "issuer" }, database: createAccountDb({ issuer: "notNull" }), }); @@ -717,6 +725,7 @@ describe("get-migration: nullable columns for required fields", () => { const warnings: string[] = []; await getMigrations({ + account: { identityStrategy: "issuer" }, database: createAccountDb({ issuer: "nullable" }), logger: warnLogger(warnings), }); @@ -772,7 +781,10 @@ describe("get-migration: nullable columns for required fields", () => { describe("get-migration: inspecting a migration that cannot be applied", () => { it("reports the unsafe column change and still compiles the statements", async () => { const { compileMigrations, unsafeChanges } = await getMigrations( - { database: createAccountDb({}) }, + { + account: { identityStrategy: "issuer" }, + database: createAccountDb({}), + }, { throwOnUnsafe: false }, );