1

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
drieu
  • 187
  • 13

2 Answers2

1

In your application.yml file change the dbCreate: create-drop to dbCreate: create.

kumar
  • 41
  • 2
1

Follow these steps:

  1. Create a new schema in your database as Super Admin
  2. Change your username and password as your new schema in application.yml
  3. Change your dbCreate: create-drop to dbCreate: update
Syed Sarek
  • 373
  • 2
  • 12