[Solved] applying migrations...error: type "application_status" does not exist

Hi! I am getting this error when trying pgEnum

schema.ts

import { boolean, integer, jsonb, pgTable, serial, text, timestamp, pgEnum } from "drizzle-orm/pg-core";


const applicationStatus = pgEnum("application_status", ["pending", "accepted", "rejected"]);
export const clanApplicationTable = pgTable("clan_application_table", {
    id: serial("id").primaryKey(),
    tag: text("tag").notNull().unique(),
    playerData: jsonb("player_data").$type<APIPlayer>().notNull(),
    discordId: text("discord_id").notNull(),
    status: applicationStatus("status").notNull().default("pending"),
    createdAt: timestamp("created_at").notNull().defaultNow()
});


I tried without .notNull().default("pending") too but it doesn't work

the generated migration file is

CREATE TABLE "clan_application_table" (
    "id" serial PRIMARY KEY NOT NULL,
    "tag" text NOT NULL,
    "player_data" jsonb NOT NULL,
    "discord_id" text NOT NULL,
    "status" "application_status" DEFAULT 'pending' NOT NULL,
    "created_at" timestamp DEFAULT now() NOT NULL,
    CONSTRAINT "clan_application_table_tag_unique" UNIQUE("tag")
);


I don't see anywhere where it defined application_status enum.
Was this page helpful?