-
Notifications
You must be signed in to change notification settings - Fork 0
/
db-initialization.sql
65 lines (51 loc) · 1.44 KB
/
db-initialization.sql
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
59
60
61
62
63
64
65
CREATE SCHEMA test_schema;
-- Create tables and insert values needed
INSERT INTO test_schema."user"(
id, email, password, username)
VALUES (1, '[email protected]', '$2a$10$HkkcaMM6MsOp0lob/iDGIuibyve6wUKU5JQRhzCCOH45JoGSlsN9i', 'admin') ,
(2, '[email protected]', '$2a$10$zjhm6CMZvOg9cwifTDb1EugFCGk8pg9bjHpQhMabdReG4yXZ3vqjm', 'mod') ,
(3, '[email protected]', '$2a$10$O4DRQel1qxdSZnHLjD0Xnu8ZkJM8n5PDSNVpeVcCC9K05dIDANNgS', 'user');
INSERT INTO test_schema.role(
id, name)
VALUES (1, 'admin') , (2, 'mod') , (3, 'user');
INSERT INTO test_schema.skill(
id, name)
VALUES (1, 'Java') , (2, 'Selenium') , (3, 'Automation API Testing'), (4, 'Oracle');
INSERT INTO test_schema.userrole(
id, roleid, userid)
VALUES (1, 1, 1) , (2, 2, 1) , (3, 3, 1);
INSERT INTO test_schema.userskill(
id, skillid, userid)
VALUES (1, 1, 1) , (2, 3, 1);
-- Java project creates the tables so no needed to run these...
CREATE TABLE test_schema.userskill
(
id numeric,
skillid numeric,
userid numeric
);
CREATE TABLE test_schema.user
(
id numeric,
email varchar(255),
password varchar(255),
username varchar(255)
);
CREATE TABLE test_schema.role
(
id numeric,
name varchar(255)
);
CREATE TABLE test_schema.userrole
(
id numeric,
roleid numeric,
userid numeric
);
CREATE TABLE test_schema.skill
(
id numeric,
name varchar(255)
);
-- DROPS
DROP TABLE test_schema.user, test_schema.role, test_schema.skill, test_schema.userrole, test_schema.userskill;