복붙노트

[SPRING] Spring Boot에서 사용되는 데이터베이스 스키마 변경

SPRING

Spring Boot에서 사용되는 데이터베이스 스키마 변경

Spring Boot에서 사용하는 데이터베이스 스키마를 어떻게 지정합니까? 기본 절전 모드 (= 기본값)와 포스트그레스 (하지만 일반 솔루션을 원합니다)를 사용하고 있습니다. JDBC URL을 지정하는 방법을 알고 있습니다.

spring.datasource.url=jdbc:postgresql:db_name

그러나 불행히도 postgresql은 JDBC URL에서 스키마를 지정할 수 없습니다. 하이버 네이트 프로퍼티 hibernate.default_schema가 있다는 것을 알고 있으므로 다음 프로퍼티 중 하나가 작동하기를 바랬습니다 :

hibernate.default_schema=schema
spring.hibernate.default_schema=schema
spring.jpa.hibernate.default_schema=raw_page

그러나 불행히도 그들 중 어느 누구도 결과가없는 것으로 보인다.

해결법

  1. ==============================

    1.spring.jpa.properties.hibernate.default_schema = schema를 사용하십시오.

    spring.jpa.properties.hibernate.default_schema = schema를 사용하십시오.

    스프링 부트 레퍼런스 가이드 :

    http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-configure-jpa-properties를 참조하십시오.

    사용 가능한 속성의 전체 목록은 http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-configure-jpa-properties를 참조하십시오.

  2. from https://stackoverflow.com/questions/24278659/change-database-schema-used-by-spring-boot by cc-by-sa and MIT license