You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATETYPE "public"."roles"AS ENUM('user', 'admin');
CREATETABLEIF NOT EXISTS "users" (
"id"varchar(36) PRIMARY KEYNOT NULL,
"name"varchar(255) NOT NULL,
"email"varchar(255) NOT NULL,
"role""roles" DEFAULT 'user',
"created_at"timestamp DEFAULT now() NOT NULL,
CONSTRAINT"users_email_unique" UNIQUE("email")
);
While migrating this an error came as: applying migrations...error: type "roles" does not exist
I needed to change the sql file a bit to make it work perfectly. I added few line of code which should've been added automatically.
New sql file:
CREATETYPE "public"."roles"AS ENUM('user', 'admin');
CREATETABLEIF NOT EXISTS "users" (
"id"varchar(36) PRIMARY KEYNOT NULL,
"name"varchar(255) NOT NULL,
"email"varchar(255) NOT NULL,
"role""roles" DEFAULT 'user',
"created_at"timestamp DEFAULT now() NOT NULL,
CONSTRAINT"users_email_unique" UNIQUE("email")
);
// Extra lines
DO $$ BEGINCREATETYPE "roles" AS ENUM('admin', 'user');
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
The text was updated successfully, but these errors were encountered:
Report hasn't been filed before.
What version of
drizzle-orm
are you using?0.36.1
What version of
drizzle-kit
are you using?0.28.0
Other packages
@neondatabase/serverless
Describe the Bug
Created a User Schema with
role
.Generated Migration:
While migrating this an error came as: applying migrations...error: type "roles" does not exist
I needed to change the sql file a bit to make it work perfectly. I added few line of code which should've been added automatically.
New sql file:
The text was updated successfully, but these errors were encountered: