franek.stodulski
franek.stodulski
Explore posts from servers
DTDrizzle Team
Created by franek.stodulski on 11/8/2024 in #help
[Postgres] PostgresError: type X already exists.
PostgresError: type "media_types" already exists
PostgresError: type "media_types" already exists
I have SQL like this: CREATE TYPE "public"."media_types" AS ENUM('image', 'video');--> sta It's used only here:
CREATE TABLE IF NOT EXISTS "media" (
"id" text PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"url" text NOT NULL,
"filename" text NOT NULL,
"mediaType" "media_types" NOT NULL,
CREATE TABLE IF NOT EXISTS "media" (
"id" text PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"url" text NOT NULL,
"filename" text NOT NULL,
"mediaType" "media_types" NOT NULL,
My schema is:
export const mediaTypes = z.enum(["image", "video"]);
export type MediaType = z.infer<typeof mediaTypes>;
export const mediaType = pgEnum("media_types", mediaTypes.options);

export const TB_Media = pgTable("media", {
id: text().primaryKey().notNull().$defaultFn(nanoid),
name: text().notNull(),

url: text().notNull().unique(),
filename: text().notNull(),

mediaType: mediaType().notNull(),
export const mediaTypes = z.enum(["image", "video"]);
export type MediaType = z.infer<typeof mediaTypes>;
export const mediaType = pgEnum("media_types", mediaTypes.options);

export const TB_Media = pgTable("media", {
id: text().primaryKey().notNull().$defaultFn(nanoid),
name: text().notNull(),

url: text().notNull().unique(),
filename: text().notNull(),

mediaType: mediaType().notNull(),
This all happend after using casting to "snake_case"
1 replies
DTDrizzle Team
Created by franek.stodulski on 10/21/2024 in #help
DrizzleZod - Can't use "createSelectSchema"
No description
2 replies
DTDrizzle Team
Created by franek.stodulski on 5/23/2024 in #help
[Eslint]Drizzle `.delete()`
No description
1 replies
DTDrizzle Team
Created by franek.stodulski on 4/21/2024 in #help
[postgres][zod] createInsertSchema
No description
2 replies