[GH-ISSUE #1558] "@better-auth/cli generate" missing the end semicolon which fails Cloudflare D1 migration #8818

Closed
opened 2026-04-13 04:02:11 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @raphaelmsr on GitHub (Feb 24, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1558

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Clone https://github.com/Bekacru/better-auth-nextjs-cf-d1-example and

  • run bunx @better-auth/cli generate
  • then bunx wrangler d1 migrations apply my-database --remote

The outputted SQL's last line is
create table "verification" ("id" text not null primary key, "identifier" text not null, "value" text not null, "expiresAt" date not null, "createdAt" date, "updatedAt" date) which misses the last semicolon

Current vs. Expected behavior

SQL should be
create table "verification" ("id" text not null primary key, "identifier" text not null, "value" text not null, "expiresAt" date not null, "createdAt" date, "updatedAt" date);

What version of Better Auth are you using?

1.1.19

Provide environment information

macOS Sequoia 15.3.1 (24D70)
NextJS 14
Cloudflare D1
Bun

Which area(s) are affected? (Select all that apply)

Backend

Auth config (if applicable)


Additional context

No response

Originally created by @raphaelmsr on GitHub (Feb 24, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1558 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Clone `https://github.com/Bekacru/better-auth-nextjs-cf-d1-example` and * run ` bunx @better-auth/cli generate` * then `bunx wrangler d1 migrations apply my-database --remote` The outputted SQL's last line is `create table "verification" ("id" text not null primary key, "identifier" text not null, "value" text not null, "expiresAt" date not null, "createdAt" date, "updatedAt" date)` which misses the last semicolon ### Current vs. Expected behavior SQL should be `create table "verification" ("id" text not null primary key, "identifier" text not null, "value" text not null, "expiresAt" date not null, "createdAt" date, "updatedAt" date);` ### What version of Better Auth are you using? 1.1.19 ### Provide environment information ```bash macOS Sequoia 15.3.1 (24D70) NextJS 14 Cloudflare D1 Bun ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript ``` ### Additional context _No response_
GiteaMirror added the lockedbug labels 2026-04-13 04:02:11 -05:00
Author
Owner

@raphaelmsr commented on GitHub (Feb 25, 2025):

Issue comes from the
compiled.join(";\n\n") which doesn't add the end semi-colon

52ed183bdc/packages/better-auth/src/db/get-migration.ts (L272C1-L273C1)

<!-- gh-comment-id:2680630303 --> @raphaelmsr commented on GitHub (Feb 25, 2025): Issue comes from the `compiled.join(";\n\n")` which doesn't add the end semi-colon https://github.com/better-auth/better-auth/blob/52ed183bdca101d9140ed79ec4466f44c26b0e07/packages/better-auth/src/db/get-migration.ts#L272C1-L273C1
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8818