add create_viele_typen

This commit is contained in:
Peter Schiwy
2024-06-04 15:38:07 +02:00
parent 85f1840d7b
commit bb1946bb83
8 changed files with 89 additions and 61 deletions

View File

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

View File

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

View File

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