Empty migration generated #1288

Closed
opened 2026-03-13 08:31:26 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @starsep on GitHub (May 31, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. Run generate command for already generated schema
  2. Empty migration file is generated with only semicolon: ;

Current vs. Expected behavior

Expected:

  1. Information that no changes are needed
  2. No migration file is generated

What version of Better Auth are you using?

1.2.9-beta.6

Provide environment information

- OS: Linux
- Database: Sqlite

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

Other

Auth config (if applicable)

import { betterAuth } from "better-auth"
export const auth = betterAuth({
  emailAndPassword: {  
    enabled: true
  },
});

Additional context

No response

Originally created by @starsep on GitHub (May 31, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce 1. Run generate command for already generated schema 2. Empty migration file is generated with only semicolon: `;` ### Current vs. Expected behavior Expected: 1. Information that no changes are needed 2. No migration file is generated ### What version of Better Auth are you using? 1.2.9-beta.6 ### Provide environment information ```bash - OS: Linux - Database: Sqlite ``` ### Which area(s) are affected? (Select all that apply) Other ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ emailAndPassword: { enabled: true }, }); ``` ### Additional context _No response_
Author
Owner

@Kinfe123 commented on GitHub (Jun 2, 2025):

can you give me a repro for this ?

@Kinfe123 commented on GitHub (Jun 2, 2025): can you give me a repro for this ?
Author
Owner

@starsep commented on GitHub (Jun 4, 2025):

npm --version: 10.8.2
node --version: v20.19.2

rm -rf repro && mkdir repro && cd repro
npm add better-auth@1.2.9-beta.6
npm add better-sqlite3@11.10.0
npm install
cat <<EOF >auth.js
import { betterAuth } from "better-auth";
import Database from "better-sqlite3";

export const auth = betterAuth({
    database: new Database("database.sqlite"),
    emailAndPassword: {
        enabled: true,
    },
});
EOF
npx -y @better-auth/cli@1.2.9-beta.6 generate -y
npx @better-auth/cli@1.2.9-beta.6 migrate -y
npx @better-auth/cli@1.2.9-beta.6 generate -y
ls better-auth_migrations | wc -l
cat better-auth_migrations/$(ls better-auth_migrations | tail -n 1)

Example output


added 28 packages in 1s

5 packages are looking for funding
  run `npm fund` for details

added 38 packages, and audited 67 packages in 862ms

14 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

up to date, audited 67 packages in 542ms

14 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
2025-06-04T09:31:09.774Z SUCCESS [Better Auth]: 🚀 Schema was generated successfully!
2025-06-04T09:31:11.186Z INFO [Better Auth]: 🔑 The migration will affect the following:
-> name, email, emailVerified, image, createdAt, updatedAt fields on user table.
-> expiresAt, token, createdAt, updatedAt, ipAddress, userAgent, userId fields on session table.
-> accountId, providerId, userId, accessToken, refreshToken, idToken, accessTokenExpiresAt, refreshTokenExpiresAt, scope, password, createdAt, updatedAt fields on account table.
-> identifier, value, expiresAt, createdAt, updatedAt fields on verification table.
2025-06-04T09:31:14.062Z INFO [Better Auth]: 🚀 migration was completed successfully!
2025-06-04T09:31:15.489Z SUCCESS [Better Auth]: 🚀 Schema was generated successfully!
2
;

End of the output: 2 migrations, the last one only has semicolon

@starsep commented on GitHub (Jun 4, 2025): `npm --version`: 10.8.2 `node --version`: v20.19.2 ``` bash rm -rf repro && mkdir repro && cd repro npm add better-auth@1.2.9-beta.6 npm add better-sqlite3@11.10.0 npm install cat <<EOF >auth.js import { betterAuth } from "better-auth"; import Database from "better-sqlite3"; export const auth = betterAuth({ database: new Database("database.sqlite"), emailAndPassword: { enabled: true, }, }); EOF npx -y @better-auth/cli@1.2.9-beta.6 generate -y npx @better-auth/cli@1.2.9-beta.6 migrate -y npx @better-auth/cli@1.2.9-beta.6 generate -y ls better-auth_migrations | wc -l cat better-auth_migrations/$(ls better-auth_migrations | tail -n 1) ``` Example output ``` added 28 packages in 1s 5 packages are looking for funding run `npm fund` for details added 38 packages, and audited 67 packages in 862ms 14 packages are looking for funding run `npm fund` for details found 0 vulnerabilities up to date, audited 67 packages in 542ms 14 packages are looking for funding run `npm fund` for details found 0 vulnerabilities 2025-06-04T09:31:09.774Z SUCCESS [Better Auth]: 🚀 Schema was generated successfully! 2025-06-04T09:31:11.186Z INFO [Better Auth]: 🔑 The migration will affect the following: -> name, email, emailVerified, image, createdAt, updatedAt fields on user table. -> expiresAt, token, createdAt, updatedAt, ipAddress, userAgent, userId fields on session table. -> accountId, providerId, userId, accessToken, refreshToken, idToken, accessTokenExpiresAt, refreshTokenExpiresAt, scope, password, createdAt, updatedAt fields on account table. -> identifier, value, expiresAt, createdAt, updatedAt fields on verification table. 2025-06-04T09:31:14.062Z INFO [Better Auth]: 🚀 migration was completed successfully! 2025-06-04T09:31:15.489Z SUCCESS [Better Auth]: 🚀 Schema was generated successfully! 2 ; ``` End of the output: 2 migrations, the last one only has semicolon
Author
Owner

@Kinfe123 commented on GitHub (Jun 6, 2025):

i have updated it. this is preview pkg - npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/cli@2927

can you please try on using -

rm -rf repro && mkdir repro && cd repro
npm add better-auth@1.2.9-beta.6
npm add better-sqlite3@11.10.0
npm install
cat <<EOF >auth.js
import { betterAuth } from "better-auth";
import Database from "better-sqlite3";

export const auth = betterAuth({
    database: new Database("database.sqlite"),
    emailAndPassword: {
        enabled: true,
    },
});
EOF
npx -y https://pkg.pr.new/better-auth/better-auth/@better-auth/cli@2927 generate -y
npx https://pkg.pr.new/better-auth/better-auth/@better-auth/cli@2927 migrate -y
npx https://pkg.pr.new/better-auth/better-auth/@better-auth/cli@2927 generate -y
ls better-auth_migrations | wc -l
cat better-auth_migrations/$(ls better-auth_migrations | tail -n 1)

this should work. lemme know if it not.

@Kinfe123 commented on GitHub (Jun 6, 2025): i have updated it. this is preview pkg - `npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/cli@2927` can you please try on using - ``` rm -rf repro && mkdir repro && cd repro npm add better-auth@1.2.9-beta.6 npm add better-sqlite3@11.10.0 npm install cat <<EOF >auth.js import { betterAuth } from "better-auth"; import Database from "better-sqlite3"; export const auth = betterAuth({ database: new Database("database.sqlite"), emailAndPassword: { enabled: true, }, }); EOF npx -y https://pkg.pr.new/better-auth/better-auth/@better-auth/cli@2927 generate -y npx https://pkg.pr.new/better-auth/better-auth/@better-auth/cli@2927 migrate -y npx https://pkg.pr.new/better-auth/better-auth/@better-auth/cli@2927 generate -y ls better-auth_migrations | wc -l cat better-auth_migrations/$(ls better-auth_migrations | tail -n 1) ``` this should work. lemme know if it not.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1288