sqlx 1:n dependencies

This commit is contained in:
Peter Schiwy
2024-06-03 01:53:23 +02:00
parent bab592edf1
commit 6e6918e8ee
11 changed files with 114 additions and 59 deletions

View File

@@ -1,5 +1,5 @@
-- Add up migration script here
CREATE TABLE typen (
id SERIAL PRIMARY KEY,
typ_id SERIAL PRIMARY KEY,
name VARCHAR NOT NULL
);

View File

@@ -1,5 +1,5 @@
-- Add up migration script here
CREATE TABLE hersteller (
id SERIAL PRIMARY KEY,
hersteller_id SERIAL PRIMARY KEY,
name VARCHAR NOT NULL
);

View File

@@ -1,9 +1,9 @@
-- Add up migration script here
CREATE TABLE modelle (
id SERIAL PRIMARY KEY,
modell_id SERIAL PRIMARY KEY,
name VARCHAR NOT NULL,
typ_id SERIAL,
hersteller_id SERIAL,
CONSTRAINT fk_typ FOREIGN KEY(typ_id) REFERENCES typen(id),
CONSTRAINT fk_hersteller FOREIGN KEY (hersteller_id) REFERENCES hersteller(id)
CONSTRAINT fk_typ FOREIGN KEY(typ_id) REFERENCES typen(typ_id),
CONSTRAINT fk_hersteller FOREIGN KEY (hersteller_id) REFERENCES hersteller(hersteller_id)
)