apache / apache/grails-core

Plugin ignores schema

Open
#14,461 0 comments 0 reactions 0 assignees View on GitHub
relates-to: grails-data-hibernate5
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

### Steps to Reproduce

1. Configure an app to use default schema
```
environments:
development:
dataSources:
dataSource:
username:
password:
driverClassName: org.postgresql.Driver
dbCreate: none
url:
initialize: false
hibernate:
dialect: net.kaleidos.hibernate.PostgresqlExtensionsDialect
default_schema: default
```
1. Create a new domain class and specify different schema (than the default) in the table mapping property
```
class Staff {
Boolean isCurrent
String name

static mapping = {
table schema: 'other_than_default'
id generator: 'sequence', params: [sequence: 'staff_seq']
version false
}
}
```
2. Then run
```
grails dbm-gorm-diff --defaultSchema=default
```
### Expected Behaviour

The plugin shouldn't create migrations for the new domain class

### Actual Behaviour

The plugin generates migrations for the new domain class

### Environment Information

- **Operating System**: Alpine Linux 3.7 (Docker image)
- **Grails Version:** 3.3.5
- **Plugin Version:** 3.0.3
- **Database:** PSQL 9.5
- **JDK Version:** 8

Contributor guide

Open the contributing guide

Research direction

Start with the dbm-gorm-diff command and compare its --defaultSchema handling with the domain mapping's table schema. Reproduce the report against PostgreSQL using the supplied Grails and plugin versions; done when a domain class mapped to another schema no longer produces a migration.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, postgresql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.