forked from ejazmohammadggk/Java_sample_app
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdb-script.sql
More file actions
41 lines (31 loc) · 971 Bytes
/
db-script.sql
File metadata and controls
41 lines (31 loc) · 971 Bytes
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
use simplehr;
-- Create table
create table users
(
USERNAME VARCHAR(36) not null,
PASSWORD VARCHAR(36) not null,
ENABLED smallint not null
) ;
alter table users
add constraint USER_PK primary key (USERNAME);
-- Create table
create table user_roles
(
ROLE_ID VARCHAR(50) not null,
USERNAME VARCHAR(36) not null,
USER_ROLE VARCHAR(30) not null
) ;
alter table user_roles
add constraint USER_ROLE_PK primary key (ROLE_ID);
alter table user_roles
add constraint USER_ROLE_UK unique (USERNAME, USER_ROLE);
insert into users (USERNAME, PASSWORD, ENABLED)
values ('dbuser1', '12345', 1);
insert into users (USERNAME, PASSWORD, ENABLED)
values ('dbadmin1', '12345', 1);
insert into user_roles (ROLE_ID, USERNAME, USER_ROLE)
values ('1', 'dbuser1', 'USER');
insert into user_roles (ROLE_ID, USERNAME, USER_ROLE)
values ('2', 'dbadmin1', 'ADMIN');
insert into user_roles (ROLE_ID, USERNAME, USER_ROLE)
values ('3', 'dbadmin1', 'USER');