presenceirb/DatabaseSetup.sql

25 lines
585 B
MySQL
Raw Normal View History

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
);