Abu Somebody
Abu Somebody
DTDrizzle Team
Created by Abu Somebody on 7/8/2024 in #help
Drizzle: recreate tables with different prefix, without deleting the old ones
No description
3 replies
DTDrizzle Team
Created by Abu Somebody on 5/26/2024 in #help
Infinite reference needs type annotation
import { integer, pgTable, serial, varchar as string } from "drizzle-orm/pg-core";

const user = pgTable("users", {
id: serial("id").primaryKey().notNull(),
name: string("name").notNull(),
badgeId: integer("badge_id").notNull().references(() => badge.id),
});

const badge = pgTable("badges", {
id: serial("id").primaryKey().notNull(),
name: string("name").notNull(),
createdBy: integer("created_by").notNull().references(() => user.id), // THIS LINE
});
import { integer, pgTable, serial, varchar as string } from "drizzle-orm/pg-core";

const user = pgTable("users", {
id: serial("id").primaryKey().notNull(),
name: string("name").notNull(),
badgeId: integer("badge_id").notNull().references(() => badge.id),
});

const badge = pgTable("badges", {
id: serial("id").primaryKey().notNull(),
name: string("name").notNull(),
createdBy: integer("created_by").notNull().references(() => user.id), // THIS LINE
});
This basic example will keep shouting because user refers to badge and badge refers to user how would you guys go about solving it?
3 replies