-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsql.txt
More file actions
73 lines (61 loc) * 2.28 KB
/
sql.txt
File metadata and controls
73 lines (61 loc) * 2.28 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
59
60
61
62
63
64
65
66
67
68
69
70
create database test;
use test;
drop table IF EXISTS user_resetpwd;
drop table IF EXISTS user_activation;
drop table IF EXISTS user_roles;
drop table IF EXISTS users;
drop table IF EXISTS user_mobilelogin;
CREATE TABLE users (
username VARCHAR(45) NOT NULL ,
password VARCHAR(100) NOT NULL ,
enabled TINYINT NOT NULL DEFAULT 1 ,
firstname VARCHAR(45) NOT NULL ,
lastname VARCHAR(45) NOT NULL ,
createddate timestamp NULL ,
activateddate timestamp NULL ,
PRIMARY KEY (username)
);
CREATE TABLE user_roles (
user_role_id int(11) NOT NULL AUTO_INCREMENT,
username varchar(45) NOT NULL,
role varchar(45) NOT NULL,
PRIMARY KEY (user_role_id),
UNIQUE KEY uni_username_role (role,username),
KEY fk_username_idx (username),
CONSTRAINT fk_username FOREIGN KEY (username) REFERENCES users (username)
);
INSERT INTO users(username,firstname, lastname, password,enabled)
VALUES ('165221217@qq.com','Jack','Yu','$2a$10$klq.u0DA.sCufOtRqEai oeGBIv0S2vZnJi8x6hN4AQBdwD8YWVTSe', true);
INSERT INTO user_roles (username, role)
VALUES ('165221217@qq.com', 'ROLE_USER');
INSERT INTO user_roles (username, role)
VALUES ('165221217@qq.com', 'ADMIN');
INSERT INTO user_roles (username, role)
VALUES ('165221217@qq.com', 'ROLE_ADMIN');
CREATE TABLE user_activation (
username varchar(45) NOT NULL,
activationcode varchar(100) NOT NULL,
createddate timestamp NOT NULL ,
PRIMARY KEY (username),
UNIQUE KEY uni_username_activationcode (username,activationcode),
CONSTRAINT fk_username1 FOREIGN KEY (username) REFERENCES users (username)
);
CREATE TABLE user_resetpwd (
username varchar(45) NOT NULL,
resetpwdcode varchar(100) NOT NULL,
createddate timestamp NOT NULL ,
PRIMARY KEY (username),
UNIQUE KEY uni_username_resetpwdcode (username,resetpwdcode),
CONSTRAINT fk_username2 FOREIGN KEY (username) REFERENCES users (username)
);
CREATE TABLE user_mobilelogin (
username varchar(45) NOT NULL,
token varchar(100) NOT NULL,
createddate timestamp NOT NULL ,
PRIMARY KEY (username)
);
delete from user_mobilelogin where username='jack.yu05@sap.com';
delete from user_resetpwd where username='jack.yu05@sap.com';
delete from user_activation where username='jack.yu05@sap.com';
delete from user_roles where username='jack.yu05@sap.com';
delete from users where username='jack.yu05@sap.com';