Unable to run migration pgenum

import { pgTable, serial, text, varchar, pgEnum, numeric } from 'drizzle-orm/pg-core';

const roleEnum = pgEnum('role', ['admin', 'user']);
export const users = pgTable('users', {
id: serial('id').primaryKey(),
firstName: varchar('first_name').notNull(),
lastName: varchar('last_name').notNull(),
email: text('email').notNull(),
password: text('password').notNull(),
role: roleEnum('role').notNull()
});
import { pgTable, serial, text, varchar, pgEnum, numeric } from 'drizzle-orm/pg-core';

const roleEnum = pgEnum('role', ['admin', 'user']);
export const users = pgTable('users', {
id: serial('id').primaryKey(),
firstName: varchar('first_name').notNull(),
lastName: varchar('last_name').notNull(),
email: text('email').notNull(),
password: text('password').notNull(),
role: roleEnum('role').notNull()
});
i added a new enum but when i run migrate im getting an error and the migration did not get applied:
Using 'pg' driver for database querying
[⣷] applying migrations...error: type "role" does not exist
at /Users/jannikkoster/Documents/e-commerce/svelte-commerce/node_modules/drizzle-kit/bin.cjs:77696:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at <anonymous> (/Users/jannikkoster/Documents/e-commerce/svelte-commerce/node_modules/src/pg-core/dialect.ts:89:7)
at NodePgSession.transaction (/Users/jannikkoster/Documents/e-commerce/svelte-commerce/node_modules/src/node-postgres/session.ts:155:19)
at PgDialect.migrate (/Users/jannikkoster/Documents/e-commerce/svelte-commerce/node_modules/src/pg-core/dialect.ts:82:3)
at migrate (/Users/jannikkoster/Documents/e-commerce/svelte-commerce/node_modules/src/node-postgres/migrator.ts:10:2) {
length: 91,
Using 'pg' driver for database querying
[⣷] applying migrations...error: type "role" does not exist
at /Users/jannikkoster/Documents/e-commerce/svelte-commerce/node_modules/drizzle-kit/bin.cjs:77696:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at <anonymous> (/Users/jannikkoster/Documents/e-commerce/svelte-commerce/node_modules/src/pg-core/dialect.ts:89:7)
at NodePgSession.transaction (/Users/jannikkoster/Documents/e-commerce/svelte-commerce/node_modules/src/node-postgres/session.ts:155:19)
at PgDialect.migrate (/Users/jannikkoster/Documents/e-commerce/svelte-commerce/node_modules/src/pg-core/dialect.ts:82:3)
at migrate (/Users/jannikkoster/Documents/e-commerce/svelte-commerce/node_modules/src/node-postgres/migrator.ts:10:2) {
length: 91,
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server