Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot - How to set the default schema for PostgreSQL?

What I am currently doing in my application.properties file is:

spring.datasource.url=jdbc:postgresql://localhost:5432/myDB?currentSchema=mySchema

Isn't there another property for this? Since it looks hacky and according to a post (still finding the link sorry, will update later), it is only applicable to PostgreSQL 9.4.

like image 279
Rey Libutan Avatar asked Jun 15 '15 15:06

Rey Libutan


2 Answers

Since this is quite old and has no proper answer yet, the right property to set is the following:

spring.jpa.properties.hibernate.default_schema=yourschema
like image 181
Steffen Avatar answered Sep 22 '22 00:09

Steffen


You can try setting the default schema for the jdbc user.

1) ALTER USER user_name SET search_path to 'schema'

2) Did you try this property? spring.datasource.schema

http://docs.spring.io/spring-boot/docs/current/reference/html/howto-database-initialization.html

like image 26
jcalloway Avatar answered Sep 20 '22 00:09

jcalloway