I have to tables connected by a third relationship table. However one of the two tables has a composite primary key (see below). How can I declare the MANY_MANY relationship in a model?
CREATE TABLE T1 (
id integer,
someOtherID integer,
somevalue text,
PRIMARY KEY(id, someOtherID)
)
CREATE TABLE T2 (
id integer PRIMARY KEY,
value text
)
CREATE TABLE R (
rID1 integer,
rOtherID1 integer,
rID2 integer REFERENCES T2(id),
FOREIGN KEY (rID1, rOtherID1) REFERENCES T1(id, someOtherID),
PRIMARY KEY (rID1, rOtherID1, rID2)
)