Skip to content

Use PGlite by default for CLI generation - #61

Open
ninomaaad wants to merge 3 commits into
seveibar:mainfrom
ninomaaad:first-receipt-pglite-default
Open

Use PGlite by default for CLI generation#61
ninomaaad wants to merge 3 commits into
seveibar:mainfrom
ninomaaad:first-receipt-pglite-default

Conversation

@ninomaaad

@ninomaaad ninomaaad commented Sep 8, 2026

Copy link
Copy Markdown

bun run db:generate created by pgstrap init still selects the external PostgreSQL path unless --pglite is passed. Make CLI generation replay migrations in PGlite by default, so it creates the Zapatos declarations and SQL structure without a running PostgreSQL service. --no-pglite explicitly selects the existing configured-server path; programmatic callers retain their current default.

The temporary gateway binds to localhost and closes its sockets/database on success or failure. The schema dumper uses the temporary connection even when a higher-priority POSTGRES_URI is configured, then restores the original value. The CLI awaits generation so failures propagate through its command handler.

Closes #2.

Validation

  • bun test --timeout 15000: 8 passed, 30 assertions. CLI tests build the package, initialize a fresh project and run its actual db:generate script with all connection URI variables pointing at an unavailable database. They check generated table/column content, explicit PostgreSQL opt-out, migration errors and output-write failure exit behavior.
  • The new default-command and migration-error checks failed before the feature change. Existing tests passed after restricting the test gateway to localhost.
  • bun run build, bun run format:check and git diff --check passed. Patch application checked against the base commit.

The live PostgreSQL success path and concurrent programmatic PGlite calls were not tested. PGlite-specific extension limitations remain; --no-pglite supports opting back into an existing server.

Prepared with AI assistance; the listed checks were executed locally.

/claim #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use pglite so that postgres isn't required when generating types

1 participant