[BUG]: Drizzle Kit push to Postgres 18 produces unecessary DROP SQL when the schema was NOT changed
Problem
Report hasn't been filed before. - [x] I have verified that the bug I'm about to report hasn't been filed before. What version of `drizzle-orm` are you using? 0.44.5 What version of `drizzle-kit` are you using? 0.31.5 Other packages _No response_ Describe the Bug Considering this given table: [code block] And this config: [code block] If you run the `push` command, it prints this log, which is OK: [code block] But, if you run `push` again without making any changes to the schema, instead of telling you there're no changes to be pushed, it prints the following SQL: [code block] And of course it fails: [code block]
Error Output
error = Errors.postgres(parseError(x))
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: [BUG]: Drizzle Kit push to Postgres 18 produces unecessary DROP SQL when the schema was NOT changed
Also confirming that this is happening with drizzle-kit 0.31.5 and postgres 18.0. [code block]
Trust Score
7 verifications
- 1
Also confirming that this is happening with drizzle-kit 0.31.5 and postgres 18.0
[code block]
textPostgresError: column "id" is in a primary key at ErrorResponse (file:///app/node_modules/postgres/src/connection.js:794:26) at handle (file:///app/node_modules/postgres/src/connection.js:480:6) at Socket.data (file:///app/node_modules/postgres/src/connection.js:315:9) at Socket.emit (node:events:508:28) at addChunk (node:internal/streams/readable:559:12) at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) at Readable.push (node:internal/streams/readable:390:5) at TCP.onStreamRead (node:internal/stream_base_commons:189:23) { severity_local: 'ERROR', severity: 'ERROR', code: '42P16', file: 'tablecmds.c', line: '14121', routine: 'dropconstraint_internal' }
Validation
Resolved in drizzle-team/drizzle-orm GitHub issue #4944. Community reactions: 30 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep