-
Notifications
You must be signed in to change notification settings - Fork 0
/
tables.js
34 lines (32 loc) · 851 Bytes
/
tables.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module.exports = [
// USERS table
`CREATE TABLE IF NOT EXISTS USERS
(
USER_ID INT NOT NULL AUTO_INCREMENT,
FIRST_NAME VARCHAR(20) NOT NULL,
LAST_NAME VARCHAR(20) NOT NULL,
EMAIL VARCHAR(30) NOT NULL UNIQUE,
PASSWORD VARCHAR(256) NOT NULL,
CONSTRAINT USERS_PK PRIMARY KEY (USER_ID)
)AUTO_INCREMENT = 2000;`,
// USER_AUTH table
`CREATE TABLE IF NOT EXISTS USER_AUTH
(
AUTH_ID INT AUTO_INCREMENT,
USER_ID INT NOT NULL,
JWT_TOKEN VARCHAR(256) NOT NULL,
CONSTRAINT USER_AUTH_PK PRIMARY KEY(AUTH_ID),
FOREIGN KEY(USER_ID) REFERENCES USERS(USER_ID)
ON UPDATE CASCADE ON DELETE CASCADE
);`,
// EVENTS table
`CREATE TABLE IF NOT EXISTS EVENTS
(
NAME VARCHAR(20) NOT NULL,
YEAR YEAR NOT NULL,
IMG_URL VARCHAR(256) NOT NULL,
DESCRIPTION VARCHAR(100) NOT NULL,
LINK VARCHAR(500) NOT NULL,
PRIMARY KEY (name)
);`
]