This commit is contained in:
Dominic Grimm 2022-12-20 19:00:12 +01:00
parent f13c9c905f
commit f614e606f4
No known key found for this signature in database
GPG key ID: 6F294212DEAAC530
15 changed files with 269 additions and 214 deletions

View file

@ -121,6 +121,14 @@ CREATE TABLE substitution_queries(
CREATE INDEX substitution_queries_active ON substitution_queries(active);
CREATE TABLE substitution_query_results(
id SERIAL PRIMARY KEY,
substitution_query_id INTEGER NOT NULL REFERENCES substitution_queries(id),
queried_at TIMESTAMP NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP
);
CREATE TYPE substitution_type AS ENUM (
'cancel',
'subst',
@ -141,7 +149,7 @@ CREATE TYPE substitution_type AS ENUM (
CREATE TABLE substitutions(
id SERIAL PRIMARY KEY,
substitution_query_id INTEGER NOT NULL REFERENCES substitution_queries(id),
substitution_query_result_id INTEGER NOT NULL REFERENCES substitution_query_results(id),
subst_type substitution_type NOT NULL,
lesson_id INTEGER NOT NULL,
start_time TIME NOT NULL,