generated from pricelees/issue-pr-template
<!-- 제목 양식 --> <!-- [이슈번호] 작업 요약 (예시: [#10] Gitea 템플릿 생성) --> ## 📝 관련 이슈 및 PR **PR과 관련된 이슈 번호** - #32 ## ✨ 작업 내용 <!-- 어떤 작업을 했는지 알려주세요! --> - region 스키마 & 초기 데이터 추가 - 애플리케이션에 Entity / Repository 추가 ## 🧪 테스트 <!-- 어떤 테스트를 생각했고 진행했는지 알려주세요! --> - 애플리케이션 기능 자체가 추가된 것은 아니기에 별도의 테스트 코드 작성은 하지 않았음. - h2 console에서는 정상 작동 확인 완료 ## 📚 참고 자료 및 기타 <!-- 참고한 자료, 또는 논의할 사항이 있다면 알려주세요! --> 정규화 관련 여러 고민이 있었으나, 데이터 자체가 변경 가능성이 크지 않고, 전체 개수도 약 3천개로 많지 않아 역정규화로 전체 데이터를 담는게 추후 활용도 면에서 더 낫다고 판단하였음. Reviewed-on: #33 Co-authored-by: pricelees <priceelees@gmail.com> Co-committed-by: pricelees <priceelees@gmail.com>
This commit is contained in:
parent
5fe1427fc1
commit
c7316b353f
@ -0,0 +1,18 @@
|
|||||||
|
package roomescape.region.infrastructure.persistence
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity
|
||||||
|
import jakarta.persistence.Id
|
||||||
|
import jakarta.persistence.Table
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "region")
|
||||||
|
class RegionEntity(
|
||||||
|
@Id
|
||||||
|
val code: String,
|
||||||
|
val sidoCode: String,
|
||||||
|
val sigunguCode: String,
|
||||||
|
val dongCode: String,
|
||||||
|
val sidoName: String,
|
||||||
|
val sigunguName: String,
|
||||||
|
val dongName: String,
|
||||||
|
)
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
package roomescape.region.infrastructure.persistence
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository
|
||||||
|
|
||||||
|
interface RegionRepository : JpaRepository<RegionEntity, String>
|
||||||
@ -4,7 +4,7 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
sql:
|
sql:
|
||||||
init:
|
init:
|
||||||
schema-locations: classpath:schema/schema-mysql.sql
|
mode: never
|
||||||
jpa:
|
jpa:
|
||||||
defer-datasource-initialization: false
|
defer-datasource-initialization: false
|
||||||
hibernate:
|
hibernate:
|
||||||
|
|||||||
@ -17,7 +17,9 @@ spring:
|
|||||||
password:
|
password:
|
||||||
sql:
|
sql:
|
||||||
init:
|
init:
|
||||||
|
mode: always
|
||||||
schema-locations: classpath:schema/schema-h2.sql
|
schema-locations: classpath:schema/schema-h2.sql
|
||||||
|
data-locations: classpath:schema/region-data.sql
|
||||||
|
|
||||||
security:
|
security:
|
||||||
jwt:
|
jwt:
|
||||||
|
|||||||
2988
src/main/resources/schema/region-data.sql
Normal file
2988
src/main/resources/schema/region-data.sql
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,13 @@
|
|||||||
|
create table if not exists region (
|
||||||
|
code varchar(10) primary key,
|
||||||
|
sido_code varchar(2) not null,
|
||||||
|
sigungu_code varchar(3) not null,
|
||||||
|
dong_code varchar(5) not null ,
|
||||||
|
sido_name varchar(20) not null,
|
||||||
|
sigungu_name varchar(20) not null,
|
||||||
|
dong_name varchar(20) not null
|
||||||
|
);
|
||||||
|
|
||||||
create table if not exists members (
|
create table if not exists members (
|
||||||
member_id bigint primary key,
|
member_id bigint primary key,
|
||||||
email varchar(255) not null,
|
email varchar(255) not null,
|
||||||
|
|||||||
@ -1,3 +1,13 @@
|
|||||||
|
create table if not exists region (
|
||||||
|
code varchar(10) primary key,
|
||||||
|
sido_code varchar(2) not null,
|
||||||
|
sigungu_code varchar(3) not null,
|
||||||
|
dong_code varchar(5) not null ,
|
||||||
|
sido_name varchar(20) not null,
|
||||||
|
sigungu_name varchar(20) not null,
|
||||||
|
dong_name varchar(20) not null
|
||||||
|
);
|
||||||
|
|
||||||
create table if not exists members
|
create table if not exists members
|
||||||
(
|
(
|
||||||
member_id bigint primary key,
|
member_id bigint primary key,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user