Enum Type Creation

Having a small issue where when I run generate, my enum type is not being created, giving, an error when migrating:

This is at the top of the schema.

const roleEnum = pgEnum('role', ['user', 'admin']);

export const users = pgTable('user', {
    id: text()
        .primaryKey()
        .$defaultFn(() => crypto.randomUUID()),
    name: text(),
    email: text().unique(),
    emailVerified: timestamp({ mode: 'date' }),
    password: text(),
    image: text(),
    role: roleEnum().notNull().default('user'),
});


With the error on migrate being that role doesn't exist.

Do we just manually add the type definition in the sql or have I missed a step?
Was this page helpful?