How do I create a fk to a uuid column?
My schema:
When I try to push this I get
error: column "id" cannot be cast automatically to type uuid
2 Replies
any help?
The error is only happening during
push
which is a migration right? So perhaps you can inspect the SQL that gets generated for your migrations and see if you can find the issue there, perhaps by running the changes manually
It sounds to me like you've changed the type of data type for id
or overlay_id
. So you might have to manually alter your migration sql files to do an extra step.
Searching for pg error cannot be cast automatically to type uuid
shows a lot of results for how to deal with it in general.
My bad, it says here - https://orm.drizzle.team/docs/drizzle-kit-push
drizzle-kit push lets you literally push your schema and subsequent schema changes directly to the database while omitting SQL files generationSo it doesn't generate SQL files for
push
. So I would recommend using drizzle-kit generate
instead so you can see what's going on. I don't know how it will work for a project that previously used push
.