Introspection composite foreign keys pointing to composite primary keys
See original GitHub issuecreate table a (
one integer not null,
two integer not null,
primary key ("one", "two")
);
create table b (
one integer not null,
two integer not null,
foreign key ("one", "two") references a ("one", "two")
);
insert into a ("one", "two") values (1, 2);
insert into b ("one", "two") values (1, 2);
model a {
one Int
two Int
bs b[] @relation(references: [a])
@@id([one, two])
}
model b {
a a @map(["one", "two"])
}
The @relation(references: [a]) seems wrong, at least I can’t understand this.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Mapping a composite foreign key to a composite primary key
I'm having problems mapping composite keys in jpa / hibernate. The parent entity and the child entity both have composite primary keys.
Read more >Composite and Foreign Keys as Primary Key - ORM - Doctrine
Doctrine ORM supports composite primary keys natively. Composite keys are a very powerful relational database concept and we took good care to make...
Read more >Defining Composite Primary and Foreign Keys - IBM
A composite key specifies multiple columns for a primary-key or foreign-key constraint. The next example creates two tables. The first table has a...
Read more >What are explanations of primary key, foreign key, composite ...
A Composite Primary Key (CPK) is a key that uses 2 or more columns to uniquely identify each row in a table. They...
Read more >Composite and Foreign Keys as Primary Key - MikroORM
Composite and Foreign Keys as Primary Key · General Considerations · Primitive Types only · Identity through foreign Entities · Use-Case 1: Dynamic...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Yep, as long as you do not add an ID on b that is the expected result.
Can you please update the integration test to include an explicit ID here @matthewmueller?