Skip to content

Commit

Permalink
[FEAT] #657 db schema 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
wken5577 committed Mar 4, 2024
1 parent 32b9748 commit 7a84f46
Show file tree
Hide file tree
Showing 12 changed files with 133 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ public class Application extends BaseTimeEntity {
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
@JoinColumn(name = "user_id", nullable = false)
private User user;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "recruit_id")
@JoinColumn(name = "recruit_id", nullable = false)
private Recruitments recruitId;

private Boolean isDeleted;

@Enumerated(EnumType.STRING)
@Column(length = 15)
@Column(length = 15, nullable = false)
private ApplicationStatus status;
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ public class ApplicationAnswer extends BaseTimeEntity {
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "question_id")
@JoinColumn(name = "question_id", nullable = false)
private Question questionId;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "application_id")
@JoinColumn(name = "application_id", nullable = false)
private Application applicationId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public class ApplicationAnswerCheckList extends BaseTimeEntity {
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "application_answer_id")
@JoinColumn(name = "application_answer_id", nullable = false)
private ApplicationAnswer applicationAnswerId;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "check_list_id")
@JoinColumn(name = "check_list_id", nullable = false)
private CheckList checkListId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class ApplicationAnswerText extends BaseTimeEntity {
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "application_answer_id")
@JoinColumn(name = "application_answer_id", nullable = false)
private ApplicationAnswer applicationAnswerId;

@Column(length = 1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class RecruitStatus extends BaseTimeEntity {
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "application_id")
@JoinColumn(name = "application_id", nullable = false)
private Application applicationId;

private LocalDateTime interviewDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class ResultMessage extends BaseTimeEntity {
@Column(length = 100)
private String content;

@Column(length = 15)
@Column(length = 15, nullable = false)
@Enumerated(EnumType.STRING)
private MessageType messageType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class CheckList extends BaseTimeEntity {
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "question_id")
@JoinColumn(name = "question_id", nullable = false)
private Question questionId;

@Column(length = 100)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ public class Question extends BaseTimeEntity {
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "recruit_id")
@JoinColumn(name = "recruit_id", nullable = false)
private Recruitments recruitId;

@Enumerated(EnumType.STRING)
@Column(length = 20)
@Column(length = 20, nullable = false)
private InputType inputType;

@Column(length = 300)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public class Recruitments extends BaseTimeEntity {

private Boolean isDeleted;

@Column(nullable = false)
private LocalDateTime startTime;
@Column(nullable = false)

private LocalDateTime endTime;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package gg.pingpong.api.admin.tournament.service;

import static gg.data.pingpong.match.type.TournamentMatchStatus.*;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package gg.pingpong.api.user.match.service;

import static gg.data.pingpong.match.type.TournamentMatchStatus.*;
import static gg.data.pingpong.tournament.type.RoundNumber.*;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Comparator;
Expand Down
113 changes: 113 additions & 0 deletions gg-pingpong-api/src/main/resources/db/migration/V2_recruit.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
CREATE TABLE `application` (
`id` bigint NOT NULL AUTO_INCREMENT,
`created_at` datetime(6) NOT NULL,
`modified_at` datetime(6) DEFAULT NULL,
`is_deleted` bit(1) DEFAULT false,
`status` varchar(15) NOT NULL ,
`recruit_id` bigint NOT NULL ,
`user_id` bigint NOT NULL ,
PRIMARY KEY (`id`),
KEY `FKnmih1vdymw1494hdj04in2e5h` (`recruit_id`),
KEY `FKldca8xj6lqb3rsqawrowmkqbg` (`user_id`),
CONSTRAINT `FKldca8xj6lqb3rsqawrowmkqbg` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
CONSTRAINT `FKnmih1vdymw1494hdj04in2e5h` FOREIGN KEY (`recruit_id`) REFERENCES `recruitments` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci


CREATE TABLE `application_answer` (
`id` bigint NOT NULL AUTO_INCREMENT,
`created_at` datetime(6) NOT NULL,
`modified_at` datetime(6) DEFAULT NULL,
`application_id` bigint NOT NULL ,
`question_id` bigint NOT NULL ,
PRIMARY KEY (`id`),
KEY `FKn2ayp7tptdv0yycdqkp2hcm63` (`application_id`),
KEY `FK59sj9jdfki14kkp34kc2jdhyj` (`question_id`),
CONSTRAINT `FK59sj9jdfki14kkp34kc2jdhyj` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`),
CONSTRAINT `FKn2ayp7tptdv0yycdqkp2hcm63` FOREIGN KEY (`application_id`) REFERENCES `application` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci


CREATE TABLE `application_answer_check_list` (
`id` bigint NOT NULL AUTO_INCREMENT,
`created_at` datetime(6) NOT NULL,
`modified_at` datetime(6) DEFAULT NULL,
`application_answer_id` bigint NOT NULL,
`check_list_id` bigint NOT NULL,
PRIMARY KEY (`id`),
KEY `FKqdnt92yg8t27q74he0ersyiax` (`application_answer_id`),
KEY `FK3mf6hfr08f2ex01aqejikxk9w` (`check_list_id`),
CONSTRAINT `FK3mf6hfr08f2ex01aqejikxk9w` FOREIGN KEY (`check_list_id`) REFERENCES `check_list` (`id`),
CONSTRAINT `FKqdnt92yg8t27q74he0ersyiax` FOREIGN KEY (`application_answer_id`) REFERENCES `application_answer` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

CREATE TABLE `application_answer_text` (
`id` bigint NOT NULL AUTO_INCREMENT,
`created_at` datetime(6) NOT NULL,
`modified_at` datetime(6) DEFAULT NULL,
`answer` varchar(1000) DEFAULT NULL,
`application_answer_id` bigint NOT NULL ,
PRIMARY KEY (`id`),
KEY `FKlhk4m3hi4r3v8xqk8lx4bx5g7` (`application_answer_id`),
CONSTRAINT `FKlhk4m3hi4r3v8xqk8lx4bx5g7` FOREIGN KEY (`application_answer_id`) REFERENCES `application_answer` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci


CREATE TABLE `recruit_status` (
`id` bigint NOT NULL AUTO_INCREMENT,
`created_at` datetime(6) NOT NULL,
`modified_at` datetime(6) DEFAULT NULL,
`interview_date` datetime(6) DEFAULT NULL,
`application_id` bigint NOT NULL ,
PRIMARY KEY (`id`),
KEY `FKrn9y1gwvfmkkoshsxyx3l4pbn` (`application_id`),
CONSTRAINT `FKrn9y1gwvfmkkoshsxyx3l4pbn` FOREIGN KEY (`application_id`) REFERENCES `application` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

CREATE TABLE `recruitments` (
`id` bigint NOT NULL AUTO_INCREMENT,
`created_at` datetime(6) NOT NULL,
`modified_at` datetime(6) DEFAULT NULL,
`contents` varchar(3000) DEFAULT NULL,
`end_time` datetime(6) NOT NULL,
`generation` varchar(50) DEFAULT NULL,
`is_deleted` bit(1) DEFAULT false,
`is_finish` bit(1) DEFAULT false,
`start_time` datetime(6) NOT NULL,
`title` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

CREATE TABLE `question` (
`id` bigint NOT NULL AUTO_INCREMENT,
`created_at` datetime(6) NOT NULL,
`modified_at` datetime(6) DEFAULT NULL,
`input_type` varchar(20) NOT NULL,
`question` varchar(300) DEFAULT NULL,
`sort_num` int NOT NULL,
`recruit_id` bigint NOT NULL ,
PRIMARY KEY (`id`),
KEY `FK44dkmx1sa8ssxjd7u5ne0ti30` (`recruit_id`),
CONSTRAINT `FK44dkmx1sa8ssxjd7u5ne0ti30` FOREIGN KEY (`recruit_id`) REFERENCES `recruitments` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

CREATE TABLE `check_list` (
`id` bigint NOT NULL AUTO_INCREMENT,
`created_at` datetime(6) NOT NULL,
`modified_at` datetime(6) DEFAULT NULL,
`content` varchar(100) DEFAULT NULL,
`question_id` bigint NOT NULL,
PRIMARY KEY (`id`),
KEY `FKksl9r4adqk1aih1fn5kihxh7b` (`question_id`),
CONSTRAINT `FKksl9r4adqk1aih1fn5kihxh7b` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

CREATE TABLE `result_message` (
`id` bigint NOT NULL AUTO_INCREMENT,
`created_at` datetime(6) NOT NULL,
`modified_at` datetime(6) DEFAULT NULL,
`content` varchar(100) DEFAULT NULL,
`is_use` bit(1) DEFAULT false,
`message_type` varchar(15) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

0 comments on commit 7a84f46

Please sign in to comment.