mirror of https://github.com/elunez/eladmin
add Match
parent
55f7ab3e21
commit
98b2cf54de
|
@ -1,8 +1,85 @@
|
||||||
-- Create event_player join table for co-host players
|
-- Create event_player join table for co-host players
|
||||||
CREATE TABLE event_co_host_player (
|
CREATE TABLE event_co_host_player
|
||||||
event_id BIGINT,
|
(
|
||||||
|
event_id BIGINT,
|
||||||
player_id BIGINT,
|
player_id BIGINT,
|
||||||
PRIMARY KEY (event_id, player_id),
|
PRIMARY KEY (event_id, player_id),
|
||||||
CONSTRAINT fk_event_player_event FOREIGN KEY (event_id) REFERENCES event(id),
|
CONSTRAINT fk_event_player_event FOREIGN KEY (event_id) REFERENCES event (id),
|
||||||
CONSTRAINT fk_event_player_player FOREIGN KEY (player_id) REFERENCES player(id)
|
CONSTRAINT fk_event_player_player FOREIGN KEY (player_id) REFERENCES player (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- Create match_group table
|
||||||
|
CREATE TABLE match_group
|
||||||
|
(
|
||||||
|
id BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
name VARCHAR(255),
|
||||||
|
event_id BIGINT,
|
||||||
|
group_team_size INT DEFAULT 2,
|
||||||
|
CONSTRAINT fk_match_group_event FOREIGN KEY (event_id) REFERENCES event (id)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Create match table
|
||||||
|
CREATE TABLE ` match `
|
||||||
|
(
|
||||||
|
id
|
||||||
|
BIGINT
|
||||||
|
PRIMARY
|
||||||
|
KEY
|
||||||
|
AUTO_INCREMENT,
|
||||||
|
match_group_id
|
||||||
|
BIGINT,
|
||||||
|
team_a_id
|
||||||
|
BIGINT,
|
||||||
|
team_b_id
|
||||||
|
BIGINT,
|
||||||
|
score_a
|
||||||
|
INT
|
||||||
|
DEFAULT
|
||||||
|
0,
|
||||||
|
score_b
|
||||||
|
INT
|
||||||
|
DEFAULT
|
||||||
|
0,
|
||||||
|
team_a_win
|
||||||
|
BIT
|
||||||
|
DEFAULT
|
||||||
|
0,
|
||||||
|
team_b_win
|
||||||
|
BIT
|
||||||
|
DEFAULT
|
||||||
|
0,
|
||||||
|
score_verified
|
||||||
|
BIT
|
||||||
|
DEFAULT
|
||||||
|
0,
|
||||||
|
CONSTRAINT
|
||||||
|
fk_match_group
|
||||||
|
FOREIGN
|
||||||
|
KEY
|
||||||
|
(
|
||||||
|
match_group_id
|
||||||
|
) REFERENCES match_group
|
||||||
|
(
|
||||||
|
id
|
||||||
|
),
|
||||||
|
CONSTRAINT fk_team_a FOREIGN KEY
|
||||||
|
(
|
||||||
|
team_a_id
|
||||||
|
) REFERENCES team
|
||||||
|
(
|
||||||
|
id
|
||||||
|
),
|
||||||
|
CONSTRAINT fk_team_b FOREIGN KEY
|
||||||
|
(
|
||||||
|
team_b_id
|
||||||
|
) REFERENCES team
|
||||||
|
(
|
||||||
|
id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Add match_group_id column to team table
|
||||||
|
ALTER TABLE team
|
||||||
|
ADD COLUMN match_group_id BIGINT,
|
||||||
|
ADD CONSTRAINT fk_team_match_group FOREIGN KEY (match_group_id) REFERENCES match_group (id);
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class Match implements Serializable {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "`id`")
|
@Column(name = "id")
|
||||||
@ApiModelProperty(value = "id", hidden = true)
|
@ApiModelProperty(value = "id", hidden = true)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
@ -24,26 +24,26 @@ public class Match implements Serializable {
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "team_a_id")
|
@JoinColumn(name = "team_a_id")
|
||||||
private TeamPlayer teamA;
|
private Team teamA;
|
||||||
|
|
||||||
@Column(name = "`score_a`")
|
@Column(name = "score_a")
|
||||||
@ApiModelProperty(value = "Score A")
|
@ApiModelProperty(value = "Score A")
|
||||||
private int scoreA;
|
private int scoreA;
|
||||||
|
|
||||||
@Column(name = "`team_a_win`")
|
@Column(name = "team_a_win")
|
||||||
private boolean teamAWin;
|
private boolean teamAWin;
|
||||||
|
|
||||||
@Column(name = "`score_b`")
|
@Column(name = "score_b")
|
||||||
@ApiModelProperty(value = "Score B")
|
@ApiModelProperty(value = "Score B")
|
||||||
private int scoreB;
|
private int scoreB;
|
||||||
|
|
||||||
@Column(name = "`team_b_win`")
|
@Column(name = "team_b_win")
|
||||||
private boolean teamBWin;
|
private boolean teamBWin;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "team_b_id")
|
@JoinColumn(name = "team_b_id")
|
||||||
private Team teamB;
|
private Team teamB;
|
||||||
|
|
||||||
@Column(name = "`score_verified`")
|
@Column(name = "score_verified")
|
||||||
private boolean scoreVerified;
|
private boolean scoreVerified;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,10 +36,10 @@ public class MatchDto implements Serializable {
|
||||||
private Long matchGroupId;
|
private Long matchGroupId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "Team A id")
|
@ApiModelProperty(value = "Team A id")
|
||||||
private Long teamA;
|
private Long teamAId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "Team B id")
|
@ApiModelProperty(value = "Team B id")
|
||||||
private Long teamB;
|
private Long teamBId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "Score A")
|
@ApiModelProperty(value = "Score A")
|
||||||
private Integer scoreA;
|
private Integer scoreA;
|
||||||
|
|
|
@ -37,4 +37,7 @@ public class MatchGroupDto implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "Event id")
|
@ApiModelProperty(value = "Event id")
|
||||||
private Long eventId;
|
private Long eventId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "Group team size")
|
||||||
|
private Integer groupTeamSize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,9 @@ public class TeamDto implements Serializable {
|
||||||
@ApiModelProperty(value = "Event")
|
@ApiModelProperty(value = "Event")
|
||||||
private Long eventId;
|
private Long eventId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "Match Group")
|
||||||
|
private Long matchGroupId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "Name")
|
@ApiModelProperty(value = "Name")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue