Skip to content

Composite primary keys #107

@mcraveiro

Description

@mcraveiro

Hi sqlgen developers,

I noticed that the documentation for primary keys only mentions a single field [1]. I also did a search in the repo for "composite" and found no matches. Is there a way to declare a primary key made up of several fields by any chance? I just realised last time I had this need, I hacked around and created the composite primary key directly in SQL and now my sqlgen code is not matching the SQL, e.g.:

    primary key (id, valid_from, valid_to),

But

    sqlgen::PrimaryKey<std::string> id;

At any rate, this is not a biggie as I can always do this for new entities but it would be nice to model them correctly.

Many thanks for your time.

[1] sqlgen::PrimaryKey

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions