Database.yml block for describing the user you want to create databases as. #1802
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allow the user to define a schema config block in databases.yml with the username and password that should be used to create the databases.
Before I clean up the commit and cut down on the code duplication, I wanted to get thoughts on the overall approach. Basically, I'm running into the situation where my connection user for a particular database configuration won't have the ability to create the database, and I want a way to define a configuration in config/databases.yml that will be used only to create the database and grant the permissions. The current problem with the root user fallback is that in many cases, I won't have an interactive terminal when calling the db:create task. I also don't want to put the root credentials into the configuration.
This change allows me to define a schema block, with a username and password that will be used as a fallback if the connection user does not have permissions to create the database.