apache / apache/grails-core

Multiple data sources: allow renaming default data source (feature request)

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

Description

When using multiple data sources, there must be a default data source and it must be called 'dataSource'. In a project using several data sources, "dataSource" is not a useful semantic name. As a developer, I would like to be able to rename the default data source.

I would expect this to be a configuration parameter. There is already a GORM syntax for referring to the default data source, so I would expect that to continue to work. I would also expect an incorrectly configured system to produce an intelligible error message (see #10144 for an example of the current stack trace).

Example configuration syntax

```
dataSources:
default: sourceTwo
sourceOne:
driverClassName: org.h2.Driver
...
sourceTwo:
driverClassName: org.h2.Driver
...
sourceThree:
driverClassName: org.h2.Driver
...
```

Contributor guide

Open the contributing guide

Research direction

Begin with the dataSources configuration handling and existing GORM syntax for the default data source; use issue #10144 to understand the current failure. Done means the default source can be renamed through configuration, existing default-source references still work, and invalid configuration produces an intelligible error.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.