Skip to content

Bound unique constraint row checks - #30

Draft
joe-thom wants to merge 2 commits into
joe-thom/drizzle-kit-v1-compatfrom
joe-thom/clo2-222-bounded-row-existence
Draft

Bound unique constraint row checks#30
joe-thom wants to merge 2 commits into
joe-thom/drizzle-kit-v1-compatfrom
joe-thom/clo2-222-bounded-row-existence

Conversation

@joe-thom

@joe-thom joe-thom commented Aug 27, 2026

Copy link
Copy Markdown

What changed

Unique-constraint checks now stop after the first matching row instead of counting every row. This reduces work on PostgreSQL read replicas and preserves the empty-table decision.

Why

The Replit compatibility adapter runs this query before it asks how to handle a new unique constraint. Full-table counts increase schema-check latency and the chance of a PostgreSQL recovery conflict.

References CLO2-222
Project: DB Sprint

Validation

  • pnpm --dir drizzle-kit exec vitest run tests/api.test.ts
  • pnpm --filter @drizzle-team/drizzle-kit test:types
  • pnpm lint
  • pnpm format:check
  • pnpm --filter @drizzle-team/drizzle-kit build

Rollback

A revert is safe. This change does not write database state.

Stack

~ written by Zerg 👾 (wp-cc5da088)
Linear project: DB Sprint

@joe-thom joe-thom added the zergling-authored Authored by a Zerg zergling label Aug 27, 2026
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.

1 participant