Repository navigation
fix: migrate the database with the installed Better Auth - #101
Merged
Merged
Conversation
The db:generate and db:migrate scripts call @better-auth/cli, which is abandoned at 1.4.21 while the app runs better-auth 1.7.7. The old CLI's migration planner builds SQL that Postgres rejects, so schema changes never reached the database: error: type "oauthRefreshToken_authorizationCodeId_idx" does not exist db:migrate now runs scripts/migrate.js, which uses the installed library, seeds the planner client, and is what the Heroku release phase already runs. db:generate is removed: the 1.7 CLI reports schema status instead of writing SQL, and nothing reads the files it used to produce. The e2e job no longer runs migrations twice.
`db:migrate` now runs `scripts/container.sh ensure` first, so the documented fresh-setup order (migrate, then `npm run dev`) works on a machine that has never started the dev database. The script exits 0 where apple/container is not installed, so CI is unchanged. AGENTS.md no longer claims local development uses SQLite. It documents the container reset procedure, and records that `db:migrate` seeds the planner OAuth client.
mroderick
marked this pull request as ready for review
November 11, 2026 14:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Local and CI migrations could not run, so the database schema drifted behind the app.
Problem
npm run db:migrateandnpm run db:generateshell out tonpx @better-auth/cli. npm stopped that package at 1.4.21 while the app runsbetter-auth@1.7.7, and the old planner builds SQL Postgres rejects:So migrations never applied, and the app logged a schema mismatch at startup.
Change
db:migraterunsscripts/migrate.js, the library-based migration the Heroku release phase already uses. It also seeds the planner OAuth client.db:generateis removed. The current CLI reports schema status instead of writing SQL, and nothing read the files it produced.Review notes
@better-auth/cliafter this change.test/features/oauth-provider.test.jstimes out onmaintoo, so that failure is unrelated to this branch.