Skip to content

feat: default generate to in-memory PGlite (#2) - #121

Open
theaiodotco-cloud wants to merge 1 commit into
seveibar:mainfrom
theaiodotco-cloud:feat/default-generate-pglite
Open

theaiodotco-cloud wants to merge 1 commit into
seveibar:mainfrom
theaiodotco-cloud:feat/default-generate-pglite

Conversation

@theaiodotco-cloud

Copy link
Copy Markdown

Resolves #2

@algora-pbc /claim #2

Summary

  • Defaults pgstrap generate and generate() to in-memory PGlite (pglite: true) so running bun run db:generate works out of the box without requiring a background PostgreSQL server running.
  • Exposes --no-pglite to allow generating from an external PostgreSQL database via DATABASE_URL.
  • Properly closes the temporary server, PGlite database instance, and restores process.env.DATABASE_URL in a finally block to prevent resource and socket leaks.
  • Awaits generate() inside src/cli.ts.
  • Updates README.md to document the default PGlite behavior and --no-pglite opt-out.
  • Adds regression test in tests/generate.pglite.test.ts verifying that generate() works without passing pglite: true and without an external PostgreSQL instance.

Verification

  • bun test: All 4 tests across 3 files pass 100% green.
  • bun run format:check: passes cleanly.
  • bun run build: compiles successfully without errors.

- Default pglite option to true in CLI and generate() function so type generation works without a running Postgres daemon
- Support --no-pglite to opt out and use external Postgres via DATABASE_URL
- Ensure server, PGlite instance, and DATABASE_URL are cleaned up in finally block
- Add regression test for default PGlite generation and update documentation
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