-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathup.sql
More file actions
59 lines (53 loc) · 1.54 KB
/
up.sql
File metadata and controls
59 lines (53 loc) · 1.54 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
CREATE TABLE IF NOT EXISTS applications
(
application_id VARCHAR(255) PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description TEXT
);
CREATE TABLE IF NOT EXISTS users
(
user_id VARCHAR(255) PRIMARY KEY,
username VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
last_login TIMESTAMP,
last_ip VARCHAR(255),
registration_ip VARCHAR(255),
application_id VARCHAR(255),
foreign key (application_id)
references applications (application_id)
);
CREATE TABLE IF NOT EXISTS admins
(
admin_id VARCHAR(255) PRIMARY KEY,
username VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
last_login TIMESTAMP,
last_ip VARCHAR(255),
registration_ip VARCHAR(255),
application_id VARCHAR(255),
foreign key (application_id)
references applications (application_id)
);
CREATE TABLE IF NOT EXISTS sessions
(
session_id VARCHAR(255) PRIMARY KEY,
user_id VARCHAR(255),
foreign key (user_id)
references users (user_id)
);
CREATE TABLE IF NOT EXISTS admin_sessions
(
session_id VARCHAR(255) PRIMARY KEY,
admin_id VARCHAR(255),
foreign key (admin_id)
references admins (admin_id)
);
CREATE TABLE IF NOT EXISTS license_keys
(
license_key_id VARCHAR(255) PRIMARY KEY,
application_id VARCHAR(255),
foreign key (application_id)
references applications (application_id)
);