How to make composite foreign key for sqlite database in drizzle schema?

88 views Asked by At

Below are the schema I want to implement (if that makes sense)

CREATE TABLE parent_table (
    parent_id1 INTEGER,
    parent_id2 INTEGER,
    data TEXT,
    PRIMARY KEY (parent_id1, parent_id2)
);

REATE TABLE child_table (
    child_id INTEGER PRIMARY KEY,
    parent_id1 INTEGER,
    parent_id2 INTEGER,
    child_data TEXT,
    FOREIGN KEY (parent_id1, parent_id2) REFERENCES parent_table(parent_id1, parent_id2)
);

How to implement this in drizzle?

0

There are 0 answers