33 lines
883 B
SQL
33 lines
883 B
SQL
-- Add migration script here
|
|
CREATE TABLE teachers (
|
|
id INTEGER PRIMARY KEY,
|
|
ansprache TEXT NOT NULL,
|
|
last_name TEXT NOT NULL,
|
|
subject_id INTEGER NOT NULL,
|
|
FOREIGN KEY(subject_id) REFERENCES subjects(id)
|
|
);
|
|
CREATE TABLE subjects (
|
|
id INTEGER PRIMARY KEY,
|
|
name TEXT NOT NULL
|
|
);
|
|
CREATE TABLE appointments (
|
|
id INTEGER PRIMARY KEY,
|
|
teacher_id INTEGER NOT NULL,
|
|
slot_id INTEGER NOT NULL,
|
|
nutzer_id INTEGER NOT NULL,
|
|
validation_key TEXT NOT NULL,
|
|
expires DATETIME,
|
|
FOREIGN KEY(teacher_id) REFERENCES teachers(id),
|
|
FOREIGN KEY(slot_id) REFERENCES appointment_slots(id)
|
|
);
|
|
CREATE TABLE appointment_slots (
|
|
id INTEGER PRIMARY KEY,
|
|
start_time DATETIME NOT NULL,
|
|
end_time DATETIME NOT NULL
|
|
);
|
|
CREATE TABLE nutzer (
|
|
id INTEGER PRIMARY KEY,
|
|
name TEXT NOT NULL,
|
|
schueler TEXT NOT NULL,
|
|
email TEXT NOT NULL
|
|
); |