๊นํ์ญ khsrla9806 |
๋ฐ์ฅํฌ jeanparkk |
๊นํ์ญ
- ํ ์ด๋ธ SQL ์ค๊ณ
- Player, OutPlayer ๋ชจ๋ธ, DAO ์ค๊ณ
- PlayerService, OutPlayerService ๊ตฌํ
- Player, OutPlayer View ๊ตฌํ
- ์ ์ฒด ๊ธฐ๋ฅ ํ ์คํธ ๋ฐ ๋ฆฌํํ ๋ง
๋ฐ์ฅํฌ
- ํ ์ด๋ธ SQL ์ค๊ณ
- Stadium, Team ๋ชจ๋ธ, DAO ์ค๊ณ
- StadiumService, TeamService ๊ตฌํ
- Stadium, Team View ๊ตฌํ
- ์ ์ฒด ๊ธฐ๋ฅ ํ ์คํธ ๋ฐ ๋ฆฌํํ ๋ง
๋ฐ์ดํฐ๋ฒ ์ด์ค ์คํค๋ง/ํ
์ด๋ธ ์์ฑ
create database baseball;
use baseball;
create table stadium(
id int primary key auto_increment,
name varchar(20),
created_at timestamp
);
create table team (
id int primary key auto_increment,
stadium_id int,
name varchar(20),
created_at timestamp,
foreign key(stadium_id) references stadium(id)
);
create table player(
id int primary key auto_increment,
team_id int,
name varchar(20),
position varchar(10),
created_at timestamp,
unique(team_id, position),
foreign key (team_id) references team(id)
);
create table out_player(
id int primary key auto_increment,
player_id int,
reason varchar(255),
created_at timestamp,
foreign key(player_id) references player(id)
);
์์กด์ฑ ์ถ๊ฐ
dependencies {
implementation 'org.assertj:assertj-core:3.24.2'
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.28'
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.28'
implementation 'com.mysql:mysql-connector-j:8.0.32'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
DBConnection ์์ฑ
public class DBConnection {
public static Connection getConnection(){
String url = "jdbc:mysql://localhost:3306/baseball";
String username = "root";
String password = "root1234";
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection connection = DriverManager.getConnection(url, username, password);
return connection;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
DBCOnnection ์ฐ๋ ํ
์คํธ
class DBConnectionTest {
@Test
@DisplayName("DB Connection ํ
์คํธ")
void DBConnectionTest() {
// Given & When
Connection connection = DBConnection.getConnection();
// Then
assertThat(connection).isNotNull();
}
}
feat: ์๋ก์ด ๊ธฐ๋ฅ ์ถ๊ฐํ์ ๋
fix: ๋ฒ๊ทธ๋ ์ค๋ฅ ์์ ํ์ ๋
refactor: ์ฝ๋ ๋ฆฌํฉํ ๋งํ์ ๋
chore: ์ฝ๊ฐ ์ ๋งคํ ๊ธฐํ ๋ณ๊ฒฝ์ฌํญ
docs: ๋ฆฌ๋๋ฏธ ํ์ผ์ด๋ md ํ์ผ ์์ ํ ๋ (๋ฌธ์์์
)
- ๊ฐ์ ์์ ๋ธ๋์น๋ฅผ ์์ฑํ์ฌ ๋งก์ ์์ ์ ์งํ
- ์์
์ด ๋๋๋ฉด
develop
๋ธ๋์น๋ก Pull Request๋ฅผ ์์ฒญ - ๋ชจ๋ PR์ด ๋๋๋ฉด ๋ชจ์ฌ์ ์ฝ๋ ๋ ผ์ ํ์ merge ์งํ
- ๋ชจ๋ ์์
์ด ๋๋ ํ
develop
๋ธ๋์น์์ ๊ฐ์ ์ ์ฒด ๊ธฐ๋ฅ ํ ์คํธ - ๋ชจ๋ ํ
์คํธ ์๋ฃ ์
main
๋ธ๋์น๋ก merge