Rodrigo
Rodrigo
Explore posts from servers
DTDrizzle Team
Created by Rodrigo on 3/21/2024 in #help
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] }),
}),
);
2 replies