Mini
Mini
Explore posts from servers
DTDrizzle Team
Created by Mini on 1/15/2025 in #help
[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()
});
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")
);
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.
3 replies
DTDrizzle Team
Created by Mini on 7/26/2024 in #help
Using drizzle with dynamic drivers
Hi! How can i use drizzle with dynamic drivers ? I am using it in my frontend, but the db is mainly handles by backend using sqlalchemy. So for frontend, i just introspect db and pull the schema and relations from it. Worked fine for introspect since it asks for stuff and i can pull in from env, but when i want to make db i am confused on how to do. Because there are different packages and different formats
3 replies