Major overhaul of schema for tables not really used, but ran into issues until I dropped a table

So I merged in some changes to my default branch that were contributed by a buddy of mine. I want to apply these changes to my production db. The person contributing tested things locally and everything worked out just fine. However, when I ran drizzle-kit push locally on my local DB I ran into an issue
PostgresError: foreign key constraint "weeks_season_type_id_season_types_id_fk" cannot be implemented
at ErrorResponse (file:///Users/jamessingleton/Code/Businesses/redshirt-sports/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/src/connection.js:794:26)
at handle (file:///Users/jamessingleton/Code/Businesses/redshirt-sports/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/src/connection.js:480:6)
at Socket.data (file:///Users/jamessingleton/Code/Businesses/redshirt-sports/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/src/connection.js:315:9)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TCP.onStreamRead (node:internal/stream_base_commons:189:23) {
severity_local: 'ERROR',
severity: 'ERROR',
code: '42804',
detail: 'Key columns "season_type_id" and "id" are of incompatible types: integer and text.',
file: 'tablecmds.c',
line: '9432',
routine: 'ATAddForeignKeyConstraint'
}
PostgresError: foreign key constraint "weeks_season_type_id_season_types_id_fk" cannot be implemented
at ErrorResponse (file:///Users/jamessingleton/Code/Businesses/redshirt-sports/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/src/connection.js:794:26)
at handle (file:///Users/jamessingleton/Code/Businesses/redshirt-sports/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/src/connection.js:480:6)
at Socket.data (file:///Users/jamessingleton/Code/Businesses/redshirt-sports/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/src/connection.js:315:9)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TCP.onStreamRead (node:internal/stream_base_commons:189:23) {
severity_local: 'ERROR',
severity: 'ERROR',
code: '42804',
detail: 'Key columns "season_type_id" and "id" are of incompatible types: integer and text.',
file: 'tablecmds.c',
line: '9432',
routine: 'ATAddForeignKeyConstraint'
}
But when I dropped the weeks table and re-ran drizzle-kit push it pushed just fine. I was asked about some renaming and if creating a column, etc though. Normally I do drizzle-kit migrate before my build command in Next.js but running into this issue kind of makes me pause and scratch my head on the best way to make changes like this.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?