Open callmetwan opened 6 days ago
drizzle-orm
0.33.0
drizzle-kit
0.23.2
Changing a (postgres) schema from text to uuid results in the error:
text
uuid
PostgresError: column user_id cannot be cast automatically to type uuid
MigrationSQL generated:
ALTER TABLE "schemaname"."tablename" ALTER COLUMN "user_id" SET DATA TYPE uuid;
Adding USING user_id::uuid seems to resolve the issue:
USING user_id::uuid
ALTER TABLE "schemaname"."tablename" ALTER COLUMN "user_id" SET DATA TYPE uuid USING user_id::uuid;
Sample schema:
pgSchema("schemaname").table("tablename", { id: uuid("id").defaultRandom().primaryKey(), userId: text("user_id").notNull(), });
Changed to this:
pgSchema("schemaname").table("tablename", { id: uuid("id").defaultRandom().primaryKey(), userId: uuid("user_id").notNull(), });
I think these are the same issue https://github.com/drizzle-team/drizzle-orm/issues/2751
I think these are the same issue #2751
Yup, looks to be the same! I’ll close this one.
What version of
drizzle-orm
are you using?0.33.0
What version of
drizzle-kit
are you using?0.23.2
Describe the Bug
Changing a (postgres) schema from
text
touuid
results in the error:MigrationSQL generated:
Expected behavior
Adding
USING user_id::uuid
seems to resolve the issue:Environment & setup
Sample schema:
Changed to this:
MigrationSQL generated: