Unable to rename table that uses a composite key

When renaming a table that uses composite key I get the following error:
drizzle-kit: v0.20.14
drizzle-orm: v0.30.4

TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')
...
drizzle-kit: v0.20.14
drizzle-orm: v0.30.4

TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')
...
Here is an excerpt of my schema showing the table:
export const userToAccount = pgTable(
'user_to_account', // This was changed from something else
{
accountId: uuid('account_id')
.references(() => accounts.id)
.notNull(),
userId: uuid('user_id')
.references(() => users.id)
.notNull(),
createdAt: timestamp('created_at').defaultNow().notNull(),
},
(table) => ({
pk: primaryKey({ columns: [table.userId, table.accountId] }),
}),
);
export const userToAccount = pgTable(
'user_to_account', // This was changed from something else
{
accountId: uuid('account_id')
.references(() => accounts.id)
.notNull(),
userId: uuid('user_id')
.references(() => users.id)
.notNull(),
createdAt: timestamp('created_at').defaultNow().notNull(),
},
(table) => ({
pk: primaryKey({ columns: [table.userId, table.accountId] }),
}),
);
1 Reply
Tibo
Tibo8mo ago
@Rodrigo I have the same problem. Did you solve it ?
Want results from more Discord servers?
Add your server