fantasy
fantasy
Explore posts from servers
DTDrizzle Team
Created by fantasy on 5/14/2024 in #help
uuid becomes text in migration
In my schema i have a user table (based on auth.js requirements):
export const users = pgTable("user", {
id: uuid("id").primaryKey().defaultRandom(),
name: text("name"),
email: text("email").notNull(),
emailVerified: timestamp("emailVerified", { mode: "date" }),
image: text("image"),
});
export const users = pgTable("user", {
id: uuid("id").primaryKey().defaultRandom(),
name: text("name"),
email: text("email").notNull(),
emailVerified: timestamp("emailVerified", { mode: "date" }),
image: text("image"),
});
However in the resulting migration, the column is marked as text and is missing the DEFAULT gen_random_uuid():
CREATE TABLE IF NOT EXISTS "user" (
"id" text PRIMARY KEY NOT NULL,
...
CREATE TABLE IF NOT EXISTS "user" (
"id" text PRIMARY KEY NOT NULL,
...
This does not happen for other tables, for example:
export const roles = pgTable("role", {
id: uuid("id").primaryKey().defaultRandom(),
...
export const roles = pgTable("role", {
id: uuid("id").primaryKey().defaultRandom(),
...
CREATE TABLE IF NOT EXISTS "role" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
...
CREATE TABLE IF NOT EXISTS "role" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
...
I'm using the latest drizzle-kit 0.21.1 version.
1 replies