presenceirb/DatabaseSetup.sql
Louis Vallat ac4f691c92 Added 5 minutes to the range of events to get
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
2020-11-27 09:53:13 +01:00

24 lines
584 B
SQL

DROP TABLE students, events;
CREATE TABLE IF NOT EXISTS students
(
id int GENERATED ALWAYS AS IDENTITY,
snowflake text NOT NULL,
ade_resource int NOT NULL,
PRIMARY KEY (id),
UNIQUE (snowflake)
);
CREATE TABLE IF NOT EXISTS events
(
id int GENERATED ALWAYS AS IDENTITY,
students_id int NOT NULL,
summary text NOT NULL,
start_event timestamptz NOT NULL,
end_event timestamptz NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (students_id)
REFERENCES students (id)
ON DELETE CASCADE
);