Add composite primary keys
This page is a capture in the discarded bucket of the product backlog.
Resolved (deep backlog refinement, 2026-07-11): The capture's own body is a PR review-comment thread where the author (mcraveiro) explicitly marked the suggestion 'Won't fix', explaining the sqlgen junction-entity pattern (PrimaryKey on left column only, plain type on right column, e.g. dataset_bundle_member_entity.hpp) is intentional and the composite key is enforced via the SQL migration DDL, not the C++ annotation.
We probably already have a story for this.
projects/ores.iam/include/ores.iam/repository/account_party_entity.hpp
sqlgen::PrimaryKey<std::string> account_id; std::string tenant_id; std::string party_id; Contributor @gemini-code-assist gemini-code-assist bot 15 hours ago high
The comment on line 32 indicates a composite primary key. For a junction table, both account_id and party_id should be part of the composite primary key. party_id should also be wrapped in sqlgen::PrimaryKey to correctly define the composite key.
Suggested change std::string party_id; sqlgen::PrimaryKey<std::string> party_id; Member Author @mcraveiro mcraveiro 5 hours ago
Won't fix. This follows the established junction entity pattern in the codebase (see dataset_bundle_member_entity.hpp): the left column uses sqlgen::PrimaryKey<std::string> and the right column uses plain std::string. The sqlgen library handles composite keys this way — the actual SQL DDL defines both columns as the composite primary key via the migration script, not via the C++ entity annotation.