how to convert serial to uuid type
Hello
I'm trying out drizzle but i'm stuck on a problem
I created a
todos
table with id as serial
type, migrated and pushed it to my db, now I wanted to change the type to uuid
but the following error appears on my console
PostgresError: column "id" cannot be cast automatically to type uuid
3 Replies
Hi @sikritidakua
Experiencing the same thing right now, did you find a fix for this ?
Need more info, have you updated the schema to change to a
uuid()
?
You will either need to delete any data in your database in order to apply the migration OR create a new UUID column, change the primary key then drop the serial column (if you need to keep data)yes as I said I updated the
id
column type to uuid
. I deleted all the previous data in table
surprising thing is I can change the id
type to text()
but no uuid()
currently no but I think @pandareaper solution worth a try
currently i'm working on local database instance so I can delete previous migrations and start from scratch but i'm just curious to find the solution