apache / apache/grails-core

The schema-export command should generate separate files for multi-tenant entities

Open
#14,618 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

### Task List

- [X] Steps to reproduce provided
- [ ] Stacktrace (if present) provided
- [ ] Example that reproduces the problem uploaded to Github
- [ ] Full description of the issue provided (see below)

### Steps to Reproduce

1. Create one domain that implements MultiTenant and one that doesn't
2. Run schema export

### Expected Behaviour

Domains implementing the MultiTenant interface should be separated from those who doesn't.

### Actual Behaviour

All domain end up in ddl.sql which makes it quite cumbersome to separate afterwards.

### Environment Information

- **Grails Version:** 3.2.6
- **GORM Version:** 6.1.1

### Comment

In my case I have about 15 domains i main database and maybe 40+ in the tenant database.
Doing a schema export will produce a single ddl.sql file with all domains listed alphabetically.
I would think that the most common use case would be that you would be interested in separating the database ddl into their own files, for instance, ddl.sql and ddl-multitenant.sql.

Contributor guide

Open the contributing guide

Research direction

Start with the schema-export command and reproduce the issue using one MultiTenant domain and one regular domain on Grails 3.2.6 with GORM 6.1.1. Trace how both are written to ddl.sql, then verify that the generated schema output separates MultiTenant entities from other domains into distinct files.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.