Reputation: 367
I want to use Grails 3.3.0 with a Postgresql database and also with three schema : openlearning, data and contrib. In domain classes, I specified the schema I want (see below). My issue is that tables are created only in public schema and not in the appropriate schema.
How can I do to create tables in the correct schema ?
note : Tables are all created in public schema.The other schema are created but are empty.They doesn't contain any table.
Question Domain class :
package fr.dr.openlearning
class Question {
static mapping = {
id generator: 'increment',params:[sequence:'incr']
schema : "data"
}
application.yml :
dataSource:
driverClassName: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/openlearning
username: postgres
password: XXX
pooled: true
jmxExport: true
environments:
development:
dataSource:
dbCreate: create-drop
dataSources:
data:
dbCreate: create-drop
contrib:
dbCreate: create-drop
Upvotes: 1
Views: 470
Reputation: 413
Follow these steps:
application.yml
dbCreate: create-drop
to dbCreate: update
Upvotes: 1
Reputation: 41
In your application.yml file change the dbCreate: create-drop to dbCreate: create.
Upvotes: 1