Modelle hinzugefügt

This commit is contained in:
Peter Schiwy
2024-06-03 15:41:00 +02:00
parent 6e6918e8ee
commit 534d819865
12 changed files with 122 additions and 130 deletions

View File

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

View File

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

View File

@@ -1,9 +1,9 @@
-- Add up migration script here
CREATE TABLE modelle (
CREATE TABLE IF NOT EXISTS modelle (
modell_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),
CONSTRAINT fk_hersteller FOREIGN KEY (hersteller_id) REFERENCES hersteller(hersteller_id)
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
)