Skip to content

Support for composite Primary Keys #488

@ElijahAhianyo

Description

@ElijahAhianyo

For now there's only support for a single field as a primary key. Would be nice to have a composite_primary_key attribute as well. Ideally, this should inherently create a logical key(eg. pk) that is a tuple of the composites.

#[model]
struct Bar{
   #[model(primary_key)]
   id: Auto<u32>
}

#[model]
struct Baz{
    #[model(primary_key)
    id: Auto<u32>
} 

#[model]
struct Foo{
   #[model(composite_key)]
   bar: ForeignKey<Bar>,
   #[model(composite_key)]
   baz: ForeignKey<Baz>,
} 

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions