Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Team5 Sports League application
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Haoyu Sun
Team5 Sports League application
Commits
ae7b1fcb
Commit
ae7b1fcb
authored
9 months ago
by
Haoyu Sun
Browse files
Options
Downloads
Patches
Plain Diff
adjust database
parent
f39970e2
Branches
Branches containing commit
No related tags found
1 merge request
!54
Resolve "As an administrator, I want to generate the matches automatically so that players are divided by the program"
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/resources/data.sql
+22
-5
22 additions, 5 deletions
src/main/resources/data.sql
src/main/resources/schema.sql
+17
-11
17 additions, 11 deletions
src/main/resources/schema.sql
with
39 additions
and
16 deletions
src/main/resources/data.sql
+
22
−
5
View file @
ae7b1fcb
delete
from
information
;
delete
from
match_item
;
delete
from
ranking
;
INSERT
INTO
information
(
id
,
username
,
email
,
password
,
role
)
VALUES
(
1
,
'shy'
,
'shy@creditsafe.com'
,
'$2a$16$R0aSGzbklUhpRfIMhocewephgUDMFOffLb7faSwwHusqHh81G026i'
,
'USER'
);
INSERT
INTO
information
(
id
,
username
,
email
,
password
,
role
)
VALUES
(
2
,
'zyb'
,
'zyb@creditsafe.com'
,
'$2a$16$R0aSGzbklUhpRfIMhocewephgUDMFOffLb7faSwwHusqHh81G026i'
,
'USER'
);
INSERT
INTO
information
(
id
,
username
,
email
,
password
,
role
)
VALUES
(
3
,
'xzc'
,
'xzc@creditsafe.com'
,
'$2a$16$R0aSGzbklUhpRfIMhocewephgUDMFOffLb7faSwwHusqHh81G026i'
,
'USER'
);
INSERT
INTO
information
(
id
,
username
,
email
,
password
,
role
)
VALUES
(
4
,
'xx'
,
'xx@creditsafe.com'
,
'$2a$16$R0aSGzbklUhpRfIMhocewephgUDMFOffLb7faSwwHusqHh81G026i'
,
'USER'
);
insert
into
match_item
(
sport
,
player_AId
,
player_BId
,
plan_Time
,
status
,
score_a
,
score_b
,
confirm_a
,
confirm_b
,
winner_id
)
values
-- test data
...
...
@@ -14,10 +23,18 @@ values
-- 5: Completed status, Player 9 wins
(
'Darts'
,
1
,
2
,
'2024-11-29 15:30:00'
,
'completed'
,
300
,
280
,
TRUE
,
TRUE
,
2
),
-- 6: Confirmed status, Player 1 wins
(
'TableTennis'
,
1
,
2
,
'2024-11-30 17:00:00'
,
'confirmed'
,
3
,
1
,
TRUE
,
TRUE
,
1
);
(
'TableTennis'
,
1
,
2
,
'2024-11-30 17:00:00'
,
'confirmed'
,
3
,
1
,
TRUE
,
TRUE
,
1
),
(
'TableTennis'
,
null
,
null
,
'2024-12-20 17:00:00'
,
'pending'
,
0
,
0
,
false
,
false
,
null
),
(
'TableTennis'
,
null
,
null
,
'2024-12-21 17:00:00'
,
'pending'
,
0
,
0
,
false
,
false
,
null
),
(
'Pools'
,
null
,
null
,
'2024-12-22 17:00:00'
,
'pending'
,
0
,
0
,
false
,
false
,
null
),
(
'Pools'
,
null
,
null
,
'2024-12-23 17:00:00'
,
'pending'
,
0
,
0
,
false
,
false
,
null
),
(
'Pools'
,
null
,
null
,
'2024-12-24 17:00:00'
,
'pending'
,
0
,
0
,
false
,
false
,
null
),
(
'Darts'
,
null
,
null
,
'2024-12-25 17:00:00'
,
'pending'
,
0
,
0
,
false
,
false
,
null
),
(
'Darts'
,
null
,
null
,
'2024-12-26 17:00:00'
,
'pending'
,
0
,
0
,
false
,
false
,
null
),
(
'Darts'
,
null
,
null
,
'2024-12-27 17:00:00'
,
'pending'
,
0
,
0
,
false
,
false
,
null
);
INSERT
INTO
ranking
(
user_id
,
username
,
sport
,
wins
)
VALUES
(
1
,
'
xzc
'
,
'Pools'
,
5
),
(
2
,
'
shy
'
,
'Darts'
,
3
),
(
3
,
'x
x
'
,
'TableTennis'
,
10
),
(
2
,
'
shy
'
,
'TableTennis'
,
4
);
(
1
,
'
shy
'
,
'Pools'
,
5
),
(
2
,
'
zyb
'
,
'Darts'
,
3
),
(
3
,
'x
zc
'
,
'TableTennis'
,
10
),
(
2
,
'
xx
'
,
'TableTennis'
,
4
);
This diff is collapsed.
Click to expand it.
src/main/resources/schema.sql
+
17
−
11
View file @
ae7b1fcb
drop
table
if
exists
match_item
;
drop
table
if
exists
rankings
;
drop
table
if
exists
information
;
CREATE
TABLE
information
(
id
INT
AUTO_INCREMENT
PRIMARY
KEY
,
username
VARCHAR
(
50
)
UNIQUE
NOT
NULL
,
email
VARCHAR
(
50
)
UNIQUE
NOT
NULL
,
password
VARCHAR
(
255
)
NOT
NULL
,
role
VARCHAR
(
20
)
DEFAULT
'USER'
NOT
NULL
);
create
table
if
not
exists
match_item
(
-- Match ID
id
BIGINT
AUTO_INCREMENT
PRIMARY
KEY
,
-- Sport type
sport
ENUM
(
'Pools'
,
'Darts'
,
'TableTennis'
)
NOT
NULL
,
-- Player A ID
player_AId
BIGINT
NO
T
NULL
,
player_AId
IN
T
NULL
,
-- Player B ID
player_BId
BIGINT
NO
T
NULL
,
player_BId
IN
T
NULL
,
plan_Time
DATETIME
NOT
NULL
,
-- Match status
status
ENUM
(
'pending'
,
'confirmed'
,
'completed'
)
DEFAULT
'pending'
,
...
...
@@ -16,16 +24,14 @@ create table if not exists match_item (
score_b
INT
DEFAULT
0
,
confirm_a
BOOLEAN
DEFAULT
FALSE
,
confirm_b
BOOLEAN
DEFAULT
FALSE
,
winner_id
BIGINT
DEFAULT
NULL
);
drop
table
if
exists
information
;
CREATE
TABLE
information
(
id
INT
AUTO_INCREMENT
PRIMARY
KEY
,
username
VARCHAR
(
50
)
UNIQUE
NOT
NULL
,
email
VARCHAR
(
50
)
UNIQUE
NOT
NULL
,
password
VARCHAR
(
255
)
NOT
NULL
,
role
VARCHAR
(
20
)
DEFAULT
'USER'
NOT
NULL
winner_id
BIGINT
DEFAULT
NULL
,
#
FOREIGN
KEY
(
player_AId
)
REFERENCES
information
(
id
)
ON
DELETE
CASCADE
,
#
FOREIGN
KEY
(
player_BId
)
REFERENCES
information
(
id
)
ON
DELETE
CASCADE
FOREIGN
KEY
(
player_AId
)
REFERENCES
information
(
id
)
ON
DELETE
SET
NULL
,
FOREIGN
KEY
(
player_BId
)
REFERENCES
information
(
id
)
ON
DELETE
SET
NULL
);
drop
table
if
exists
ranking
;
CREATE
TABLE
IF
NOT
EXISTS
ranking
(
id
INT
AUTO_INCREMENT
PRIMARY
KEY
,
...
...
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