avm99963 | 7099538 | 2020-09-23 01:03:01 +0200 | [diff] [blame] | 1 | -- SQL sentences to set up all the DB tables |
| 2 | |
| 3 | CREATE 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 | |
| 10 | CREATE 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 | |
| 17 | CREATE 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 | |
avm99963 | 61ed9e5 | 2020-09-28 00:02:27 +0200 | [diff] [blame^] | 24 | CREATE 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 | |
avm99963 | 7099538 | 2020-09-23 01:03:01 +0200 | [diff] [blame] | 33 | -- @TODO: Add form completion log table |