error: relation "xxx" already exists

Hello!

Every time I run a second drizzle-kit up I get the same error, on the same table every time. I need to completely wipe my database in between

error: relation "table_filters" already exists

I went through all my relations and this doesn't have one except a FK:

export const tableFilters = pgTable(
  "table_filters",
  {
    id: text("id").primaryKey(),
    userId: varchar("user_id", {
      length: 32,
    })
      .notNull()
      .references(() => users.userId),
    name: text("name").notNull(),
    isDefault: boolean("is_default").default(false).notNull(),
    target: text("target").notNull(),
    filter: jsonb("filter").$type<Filter>().notNull(),
    createdAt: timestamp("created_at").defaultNow().notNull(),
    updatedAt: timestamp("updated_at").defaultNow(),
  },
  (table) => ({
    targetUserIdx: index("target_user_idx").on(table.target, table.userId),
  }),
);


"drizzle-kit": "^0.30.2",
"drizzle-orm": "^0.38.4",
Was this page helpful?