betterAuth + drizzle + pg throws error on `db push`

i'm getting:
PostgresError: foreign key constraint "account_user_id_user_id_fk" cannot be implemented
at ErrorResponse (file:///Users/jackbisceglia/p/planar/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/src/connection.js:794:26)
at handle (file:///Users/jackbisceglia/p/planar/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/src/connection.js:480:6)
at Socket.data (file:///Users/jackbisceglia/p/planar/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/src/connection.js:315:9)
at Socket.emit (node:events:519: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 "user_id" and "id" are of incompatible types: text and uuid.',
file: 'tablecmds.c',
line: '9896',
routine: 'ATAddForeignKeyConstraint'
}
PostgresError: foreign key constraint "account_user_id_user_id_fk" cannot be implemented
at ErrorResponse (file:///Users/jackbisceglia/p/planar/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/src/connection.js:794:26)
at handle (file:///Users/jackbisceglia/p/planar/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/src/connection.js:480:6)
at Socket.data (file:///Users/jackbisceglia/p/planar/node_modules/.pnpm/postgres@3.4.7/node_modules/postgres/src/connection.js:315:9)
at Socket.emit (node:events:519: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 "user_id" and "id" are of incompatible types: text and uuid.',
file: 'tablecmds.c',
line: '9896',
routine: 'ATAddForeignKeyConstraint'
}
i don't really think anything is particularly unique about my setup. i see the issue is described fairly clearly, but i would ideally want the codegen'd schema to work out of the box. any ideas what the issue could be from a better auth side of things? i think i've had foreign key issues in the past with postgres and drizzle, so maybe it's a drizzle thing perhaps
1 Reply
jack
jackOP2w ago
i'm using supabase also if that's relevant

Did you find this page helpful?