Skip to content

Batch PostgreSQL constraint introspection - #34

Open
joe-thom wants to merge 1 commit into
joe-thom/drizzle-jsonb-expression-defaultsfrom
joe-thom/drizzle-constraint-batching
Open

joe-thom wants to merge 1 commit into
joe-thom/drizzle-jsonb-expression-defaultsfrom
joe-thom/drizzle-constraint-batching

Conversation

@joe-thom

@joe-thom joe-thom commented Sep 10, 2026

Copy link
Copy Markdown

Summary

PostgreSQL introspection can now preload primary and unique constraints once per schema. This bounds query volume for databases with many tables.

Why

The existing path runs constraint queries for each table. Large schemas can exceed the database-diff timeout before publishing starts.

What changed

  • Adds an optional fourth argument to introspectPgDB.
  • Preloads primary and unique constraints once for each selected schema.
  • Keeps batching disabled unless the caller opts in.
  • Calls the error callback and uses existing per-table queries if a preload fails.

Validation

  • The batching tests prove opt-in behavior, snapshot equivalence, query reduction, and fallback after preload errors.
  • The package typecheck and repository format check pass.

Stack

Merge bottom to top:

  1. Fix PostgreSQL migration dependency order聽#31 PostgreSQL migration dependency order
  2. Handle PostgreSQL JSON expression defaults聽#33 JSON and JSONB expression defaults
  3. Batch PostgreSQL constraint introspection聽#34 batched constraint introspection (this PR)
  4. Prepare drizzle-kit 0.32.4 release聽#35 0.32.4 release

Rollout and rollback

The new argument is optional and batching defaults to off. This layer does not publish a package or change a consumer.

~ written by Zerg 馃懢 (wp-e307c37c)

@joe-thom
joe-thom added this pull request to stack #36 September 10, 2026 13:52
@joe-thom joe-thom added the zergling-authored Authored by a Zerg zergling label Sep 10, 2026
@joe-thom
joe-thom marked this pull request as ready for review September 10, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

zergling-authored Authored by a Zerg zergling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants