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),
});
7 Replies
rphlmr ⚡
rphlmr ⚡5mo ago
👋 Hey, looks like a bug. Did you had an other primaryKey on workShopRates before?
nukepower
nukepowerOP5mo ago
Hey, nope i didnt I just wanted to rename "value" to "id" in manufacturers table
rphlmr ⚡
rphlmr ⚡5mo ago
Hum. Does drizzle kit asked you about a choice? (create or rename)
rphlmr ⚡
rphlmr ⚡5mo ago
Something like that
No description
nukepower
nukepowerOP5mo ago
yes, I chose rename and then i had this error that i described above
rphlmr ⚡
rphlmr ⚡5mo ago
:/ looks like a bug. Can you report it at https://github.com/drizzle-team/drizzle-kit-mirror ? cc @Andrew Sherman I can't reproduce this one in drizzle.run but I can reproduce an other one where you already have a PK and try to rename / change for an other column
Andrii Sherman
Andrii Sherman4mo ago
would be really helpful to have a GH issues, so we can work on it
Want results from more Discord servers?
Add your server