Skip to content

Commit

Permalink
✨Mission(#5) : edit something to make tables
Browse files Browse the repository at this point in the history
  • Loading branch information
2ghrms committed Oct 31, 2024
1 parent 89fd912 commit 0930fd6
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
1 change: 0 additions & 1 deletion spring/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ dependencies {
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

tasks.named('test') {
Expand Down
2 changes: 1 addition & 1 deletion spring/src/main/java/umc/spring/domain/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class Member extends BaseEntity {
private Integer point;

@Enumerated(EnumType.STRING)
@Column(columnDefinition = "VARCHAR(10) DEFAULT 'ACTIVE'")
@Column(columnDefinition = "VARCHAR(15) DEFAULT 'ACTIVE'")
private MemberStatus status;

private LocalDate inactiveDate;
Expand Down
5 changes: 5 additions & 0 deletions spring/src/main/java/umc/spring/domain/Mission.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import jakarta.persistence.*;
import lombok.*;
import umc.spring.domain.common.BaseEntity;
import umc.spring.domain.mapping.MemberMission;

import java.time.LocalDate;
import java.util.*;

@Entity
@Getter
Expand All @@ -27,4 +29,7 @@ public class Mission extends BaseEntity {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "store_id")
private Store store;

@OneToMany(mappedBy = "mission", cascade = CascadeType.ALL)
private List<MemberMission> memberMissionList = new ArrayList<>();
}
5 changes: 5 additions & 0 deletions spring/src/main/java/umc/spring/domain/Region.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import lombok.*;
import umc.spring.domain.common.BaseEntity;

import java.util.*;

@Entity
@Getter
@Builder
Expand All @@ -16,4 +18,7 @@ public class Region extends BaseEntity {

@Column(nullable = false, length = 30)
private String name;

@OneToMany(mappedBy = "region", cascade = CascadeType.ALL)
private List<Store> StoreList = new ArrayList<>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ public class MemberMission {
private Long id;

@Enumerated(EnumType.STRING)
@Column(columnDefinition = "VARCHAR(15) DEFAULT 'NOT_STARTED'")
private MissionStatus status;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "member_id")
private Member member;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "food_id")
private Food food;
@JoinColumn(name = "mission_id")
private Mission mission;
}
9 changes: 4 additions & 5 deletions spring/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
spring:
datasource:
url: jdbc:mysql://localhost:3306/umc_mission
username: ${MySQL_DB_USERNAME}
password: ${MySQL_DB_PASSWORD}
url: jdbc:mysql://localhost:3306/study
username: ${MySQL_USER}
password: ${MySQL_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver
sql:
init:
mode: never
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL8Dialect
show_sql: true
format_sql: true
use_sql_comments: true
hbm2ddl:
auto: update
auto: create
default_batch_fetch_size: 1000

0 comments on commit 0930fd6

Please sign in to comment.