Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backend
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2106-v23-03
backend
Commits
9d794798
Commit
9d794798
authored
2 years ago
by
Pedro Pablo Cardona Arroyave
Browse files
Options
Downloads
Patches
Plain Diff
Tables users, authority and profiles were combined together.
parent
eb60b345
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/resources/db/sql/dbschema.sql
+3
-18
3 additions, 18 deletions
src/main/resources/db/sql/dbschema.sql
src/main/resources/db/sql/testdata.sql
+21
-20
21 additions, 20 deletions
src/main/resources/db/sql/testdata.sql
with
24 additions
and
38 deletions
src/main/resources/db/sql/dbschema.sql
+
3
−
18
View file @
9d794798
CREATE
TABLE
users
(
CREATE
TABLE
users
(
username
VARCHAR
(
50
)
NOT
NULL
PRIMARY
KEY
,
username
VARCHAR
(
50
)
NOT
NULL
PRIMARY
KEY
,
password
VARCHAR
(
500
)
NOT
NULL
,
password
VARCHAR
(
500
)
NOT
NULL
,
enabled
BOOLEAN
NOT
NULL
enabled
BOOLEAN
NOT
NULL
,
);
CREATE
TABLE
authorities
(
username
VARCHAR
(
50
)
NOT
NULL
,
authority
VARCHAR
(
50
)
NOT
NULL
,
CONSTRAINT
fk_authorities_users
FOREIGN
KEY
(
username
)
REFERENCES
users
(
username
)
);
CREATE
UNIQUE
INDEX
ix_auth_username
ON
authorities
(
username
,
authority
);
CREATE
TABLE
profiles
(
id
BIGINT
NOT
NULL
AUTO_INCREMENT
PRIMARY
KEY
,
username
VARCHAR
(
50
)
NOT
NULL
UNIQUE
,
first_name
VARCHAR
(
50
)
NOT
NULL
,
first_name
VARCHAR
(
50
)
NOT
NULL
,
last_name
VARCHAR
(
50
)
NOT
NULL
,
last_name
VARCHAR
(
50
)
NOT
NULL
,
authority
VARCHAR
(
50
)
NOT
NULL
,
email
VARCHAR
(
50
)
NOT
NULL
UNIQUE
,
email
VARCHAR
(
50
)
NOT
NULL
UNIQUE
,
birthdate
DATE
NOT
NULL
,
birthdate
DATE
NOT
NULL
,
creation_time
TIMESTAMP
NOT
NULL
DEFAULT
current_timestamp
,
creation_time
TIMESTAMP
NOT
NULL
DEFAULT
current_timestamp
,
group_id
BIGINT
NOT
NULL
,
group_id
BIGINT
NOT
NULL
,
FOREIGN
KEY
(
group_id
)
REFERENCES
groups
(
group_id
),
FOREIGN
KEY
(
group_id
)
REFERENCES
groups
(
group_id
)
CONSTRAINT
fk_profile_user
FOREIGN
KEY
(
username
)
REFERENCES
users
(
username
)
);
);
CREATE
UNIQUE
INDEX
ix_profiles_username
ON
profiles
(
username
,
id
);
CREATE
TABLE
groups
(
CREATE
TABLE
groups
(
group_id
BIGINT
NOT
NULL
AUTO_INCREMENT
PRIMARY
KEY
,
group_id
BIGINT
NOT
NULL
AUTO_INCREMENT
PRIMARY
KEY
,
group_name
VARCHAR
(
50
)
NOT
NULL
,
group_name
VARCHAR
(
50
)
NOT
NULL
,
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/db/sql/testdata.sql
+
21
−
20
View file @
9d794798
INSERT
INTO
users
(
username
,
password
,
enabled
)
INSERT
INTO
groups
(
group_name
,
level
,
points
)
VALUES
VALUES
(
'john'
,
'{noop}password123'
,
true
),
(
'Group A'
,
1
,
100
),
(
'jane'
,
'{noop}password456'
,
true
),
(
'Group B'
,
2
,
250
),
(
'bob'
,
'{noop}password789'
,
true
),
(
'Group C'
,
3
,
500
),
(
'alice'
,
'{noop}password111'
,
true
),
(
'Group D'
,
4
,
750
),
(
'tom'
,
'{noop}password222'
,
true
),
(
'Group E'
,
1
,
200
);
(
'sarah'
,
'{noop}password333'
,
true
),
(
'david'
,
'{noop}password444'
,
true
),
INSERT
INTO
users
(
username
,
password
,
enabled
,
first_name
,
last_name
,
authority
,
email
,
birthdate
,
group_id
)
(
'emily'
,
'{noop}password555'
,
true
),
VALUES
(
'mike'
,
'{noop}password666'
,
true
),
(
'john'
,
'{noop}password123'
,
true
,
'John'
,
'Doe'
,
'USER'
,
'john@example.com'
,
'1990-01-01'
,
1
),
(
'olivia'
,
'{noop}password777'
,
true
);
(
'jane'
,
'{noop}password456'
,
true
,
'Jane'
,
'Doe'
,
'USER'
,
'jane@example.com'
,
'1992-02-02'
,
1
),
(
'bob'
,
'{noop}password789'
,
true
,
'Bob'
,
'Smith'
,
'USER'
,
'bob@example.com'
,
'1995-03-03'
,
2
),
(
'alice'
,
'{noop}password111'
,
true
,
'Alice'
,
'Johnson'
,
'USER'
,
'alice@example.com'
,
'1998-04-04'
,
2
),
(
'tom'
,
'{noop}password222'
,
true
,
'Tom'
,
'Brown'
,
'USER'
,
'tom@example.com'
,
'2000-05-05'
,
3
),
(
'sarah'
,
'{noop}password333'
,
true
,
'Sarah'
,
'Lee'
,
'USER'
,
'sarah@example.com'
,
'2002-06-06'
,
3
),
(
'david'
,
'{noop}password444'
,
true
,
'David'
,
'Wilson'
,
'USER'
,
'david@example.com'
,
'2004-07-07'
,
4
),
(
'emily'
,
'{noop}password555'
,
true
,
'Emily'
,
'Davis'
,
'USER'
,
'emily@example.com'
,
'2006-08-08'
,
4
),
(
'mike'
,
'{noop}password666'
,
true
,
'Mike'
,
'Taylor'
,
'USER'
,
'mike@example.com'
,
'2008-09-09'
,
5
),
(
'olivia'
,
'{noop}password777'
,
true
,
'Olivia'
,
'Clark'
,
'USER'
,
'olivia@example.com'
,
'2010-10-10'
,
5
);
INSERT
INTO
authorities
(
username
,
authority
)
INSERT
INTO
authorities
(
username
,
authority
)
VALUES
VALUES
...
@@ -24,14 +33,6 @@ VALUES
...
@@ -24,14 +33,6 @@ VALUES
(
'mike'
,
'USER'
),
(
'mike'
,
'USER'
),
(
'olivia'
,
'ADMIN'
);
(
'olivia'
,
'ADMIN'
);
INSERT
INTO
groups
(
group_name
,
level
,
points
)
VALUES
(
'Group A'
,
1
,
100
),
(
'Group B'
,
2
,
250
),
(
'Group C'
,
3
,
500
),
(
'Group D'
,
4
,
750
),
(
'Group E'
,
1
,
200
);
INSERT
INTO
profiles
(
username
,
first_name
,
last_name
,
email
,
birthdate
,
group_id
)
INSERT
INTO
profiles
(
username
,
first_name
,
last_name
,
email
,
birthdate
,
group_id
)
VALUES
VALUES
(
'john'
,
'John'
,
'Smith'
,
'johnSmith@gmail.com'
,
'1998-05-07'
,
1
),
(
'john'
,
'John'
,
'Smith'
,
'johnSmith@gmail.com'
,
'1998-05-07'
,
1
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment