blob: 52aeac6d821ce90467294b00cb9c07e8fd69bb03 [file] [log] [blame]
avm9996370995382020-09-23 01:03:01 +02001-- SQL sentences to set up all the DB tables
2
3CREATE TABLE users (
4 id INT NOT NULL AUTO_INCREMENT,
5 PRIMARY KEY(id),
6 sub VARCHAR(255) NOT NULL UNIQUE,
7 email VARCHAR(320)
8);
9
10CREATE TABLE subjects (
11 id INT NOT NULL AUTO_INCREMENT,
12 PRIMARY KEY(id),
13 friendly_name VARCHAR(100) NOT NULL UNIQUE, -- Nom que es mostra al web
14 calendar_name VARCHAR(100) NOT NULL -- Nom al calendari de la FME
15);
16
17CREATE TABLE user_subjects (
18 id INT NOT NULL AUTO_INCREMENT,
19 PRIMARY KEY(id),
20 user_id INT NOT NULL,
21 subject_id INT NOT NULL
22);
23
avm9996361ed9e52020-09-28 00:02:27 +020024CREATE TABLE classes (
25 id INT NOT NULL AUTO_INCREMENT,
26 PRIMARY KEY(id),
27 calendar_name VARCHAR(100) NOT NULL,
28 room VARCHAR(10) NOT NULL,
29 begins DATETIME NOT NULL,
30 ends DATETIME NOT NULL
31);
32
avm9996370995382020-09-23 01:03:01 +020033-- @TODO: Add form completion log table