[PR #8164] [CLOSED] fix(cli): handle database adapter init failure in generate command #7790

Closed
opened 2026-03-13 13:49:16 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8164
Author: @himself65
Created: 2/26/2026
Status: Closed

Base: canaryHead: fix/cli-deno-generate


📝 Commits (1)

  • c623adf fix(cli): handle database adapter init failure in generate command (#8154)

📊 Changes

1 file changed (+81 additions, -0 deletions)

View changed files

📝 packages/cli/src/commands/generate.ts (+81 -0)

📄 Description

Summary

  • When native database drivers can't be loaded (e.g. better-sqlite3 in Deno), the generate command now creates a fallback adapter from config metadata so Drizzle/Prisma schema generators still work
  • For the Kysely generator (which requires a live DB connection), a clear error message is shown suggesting alternatives (use Drizzle/Prisma adapter, or run the CLI via Node.js)
  • No change in behavior for normal Node.js usage

Closes #8154

Test plan

  • Verified Drizzle schema generation works in Deno with a dialect-based config and fallback adapter
  • Verified Kysely path shows a clear error message instead of an unhandled crash
  • Existing generate.test.ts tests pass (28/28 non-native-dependent tests)
  • pnpm typecheck, pnpm lint, pnpm format:check all pass

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/8164 **Author:** [@himself65](https://github.com/himself65) **Created:** 2/26/2026 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/cli-deno-generate` --- ### 📝 Commits (1) - [`c623adf`](https://github.com/better-auth/better-auth/commit/c623adf62a1453250e4569e04254d28a110a52a0) fix(cli): handle database adapter init failure in generate command (#8154) ### 📊 Changes **1 file changed** (+81 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/cli/src/commands/generate.ts` (+81 -0) </details> ### 📄 Description ## Summary - When native database drivers can't be loaded (e.g. `better-sqlite3` in Deno), the `generate` command now creates a fallback adapter from config metadata so Drizzle/Prisma schema generators still work - For the Kysely generator (which requires a live DB connection), a clear error message is shown suggesting alternatives (use Drizzle/Prisma adapter, or run the CLI via Node.js) - No change in behavior for normal Node.js usage Closes #8154 ## Test plan - [x] Verified Drizzle schema generation works in Deno with a dialect-based config and fallback adapter - [x] Verified Kysely path shows a clear error message instead of an unhandled crash - [x] Existing `generate.test.ts` tests pass (28/28 non-native-dependent tests) - [x] `pnpm typecheck`, `pnpm lint`, `pnpm format:check` all pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 13:49:16 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#7790