Drizzle TeamDT
Drizzle Team3y ago
4 replies
liv

Composite Primary Key from Foreign Keys

export const userItemsHas = pgTable('user_items_has', {
  postId: uuid('post_id').references(() => posts.id),
  userItemId: serial("user_item_id").references(() => userItems.id),
},(table) => {
  return {
    pk: primaryKey(table.postId, table.userItemId),
  };
});

Error:
Failed to run sql query: multiple primary keys for table "user_items_has" are not allowed
Was this page helpful?