-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhoppin.sql
47 lines (40 loc) · 1.27 KB
/
hoppin.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
drop database if exists hoppin;
create database hoppin;
use hoppin;
drop table if exists app_user_role;
drop table if exists app_role;
drop table if exists app_user;
create table app_user (
app_user_id int primary key auto_increment,
username varchar(50) not null unique,
password_hash varchar(2048) not null,
disabled bit not null default(0)
);
create table app_role (
app_role_id int primary key auto_increment,
`name` varchar(50) not null unique
);
create table app_user_role (
app_user_id int not null,
app_role_id int not null,
constraint pk_app_user_role
primary key (app_user_id, app_role_id),
constraint fk_app_user_role_user_id
foreign key (app_user_id)
references app_user(app_user_id),
constraint fk_app_user_role_role_id
foreign key (app_role_id)
references app_role(app_role_id)
);
insert into app_role (`name`) values
('USER'),
('ADMIN');
-- passwords are set to "P@ssw0rd!"
insert into app_user (username, password_hash, disabled)
values
('[email protected]', '$2a$10$ntB7CsRKQzuLoKY3rfoAQen5nNyiC/U60wBsWnnYrtQQi8Z3IZzQa', 0),
('[email protected]', '$2a$10$ntB7CsRKQzuLoKY3rfoAQen5nNyiC/U60wBsWnnYrtQQi8Z3IZzQa', 0);
insert into app_user_role
values
(1, 2),
(2, 1);