nukepower
nukepower
Explore posts from servers
DTDrizzle Team
Created by nukepower on 7/21/2024 in #help
Multiple primary keys error
Hey, im having problem with migration, got this error: [⣟] applying migrations...error: multiple primary keys for table "workShopRates" are not allowed Even tho i dont have multiple primary keys. Here is my schema
export const authMake = pgTable("manufacturers", {
value: uuid("value").primaryKey(),
label: varchar("label", { length: 256 }),
});
export const workShopRates = pgTable("workShopRates", {
id: uuid("id").primaryKey().defaultRandom(),
createdBy: uuid("createdBy")
.notNull()
.default("00000000-0000-0000-0000-000000000000"),
point: varchar("point", { length: 256 }),
workShopName: varchar("workshopName", { length: 256 }),
workShopZip: varchar("workShopZip", { length: 256 }).notNull(),
hasAuth: boolean("hasAuth").notNull(),
bodyRateFrom: integer("bodyRateFrom").notNull(),
bodyRateTo: integer("bodyRateTo").notNull(),
paintRateFrom: integer("paintRateFrom").notNull(),
paintRateTo: integer("paintRateTo").notNull(),
serviceFrom: integer("serviceFrom").notNull(),
serviceTo: integer("serviceTo").notNull(),
additionalInformation: text("additionalInformation"),
createdAt: date("createdAt").defaultNow(),
authMakeValue: uuid("authMakeValue").references(() => authMake.value),
});
export const authMake = pgTable("manufacturers", {
value: uuid("value").primaryKey(),
label: varchar("label", { length: 256 }),
});
export const workShopRates = pgTable("workShopRates", {
id: uuid("id").primaryKey().defaultRandom(),
createdBy: uuid("createdBy")
.notNull()
.default("00000000-0000-0000-0000-000000000000"),
point: varchar("point", { length: 256 }),
workShopName: varchar("workshopName", { length: 256 }),
workShopZip: varchar("workShopZip", { length: 256 }).notNull(),
hasAuth: boolean("hasAuth").notNull(),
bodyRateFrom: integer("bodyRateFrom").notNull(),
bodyRateTo: integer("bodyRateTo").notNull(),
paintRateFrom: integer("paintRateFrom").notNull(),
paintRateTo: integer("paintRateTo").notNull(),
serviceFrom: integer("serviceFrom").notNull(),
serviceTo: integer("serviceTo").notNull(),
additionalInformation: text("additionalInformation"),
createdAt: date("createdAt").defaultNow(),
authMakeValue: uuid("authMakeValue").references(() => authMake.value),
});
10 replies