grails PostgreSQL not creating tables

221 views Asked by At

I am using grails 3 with following dependency in build.gradle

runtime group: 'org.postgresql', name: 'postgresql', version: '9.4.1209'

my application.yml has the following config

hibernate:
    cache:
        queries: false
        use_second_level_cache: true
        use_query_cache: false
        region.factory_class: 'org.hibernate.cache.ehcache.EhCacheRegionFactory'

dataSource:
    pooled: true
    jmxExport: true
    driverClassName: org.postgresql.Driver
    username: postgres
    password: test

environments:
    development:
        dataSource:
            dbCreate: create-drop
            url: jdbc:postgresql://localhost:5432/devdb
    test:
        dataSource:
            dbCreate: update
            url: jdbc:postgresql://localhost:5432/testdb
    production:
        dataSource:
            dbCreate: update
            url: jdbc:postgresql://localhost:5432/proddb
            properties:
                jmxEnabled: true
                initialSize: 5
                maxActive: 50
                minIdle: 5
                maxIdle: 25
                maxWait: 10000
                maxAge: 600000
                timeBetweenEvictionRunsMillis: 5000
                minEvictableIdleTimeMillis: 60000
                validationQuery: SELECT 1
                validationQueryTimeout: 3
                validationInterval: 15000
                testOnBorrow: true
                testWhileIdle: true
                testOnReturn: false
                jdbcInterceptors: ConnectionState
                defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED
---

My domain class looks like the following

import grails.rest.Resource

@Resource(uri='/issue')
class Issue {
    String issueKey
    static constraints = {
    }
}

When the server starts no table is created and it throws following exception when reading data on list screens

Caused by: org.postgresql.util.PSQLException: ERROR: relation "issue" does not exist
  Position: 13

The same code works perfectly fine with H2

0

There are 0 answers