-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable DATABASE_URL to control the placement of all of the databases #114
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= fix_database_config %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# PostgreSQL. Versions 9.3 and up are supported. | ||
# | ||
# Install the pg driver: | ||
# gem install pg | ||
# On macOS with Homebrew: | ||
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config | ||
# On Windows: | ||
# gem install pg | ||
# Choose the win32 build. | ||
# Install PostgreSQL and put its /bin directory on your path. | ||
# | ||
# Configure Using Gemfile | ||
# gem "pg" | ||
# | ||
default: &default | ||
adapter: postgresql | ||
encoding: unicode | ||
# For details on connection pooling, see Rails configuration guide | ||
# https://guides.rubyonrails.org/configuring.html#database-pooling | ||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> | ||
|
||
|
||
development: | ||
<<: *default | ||
database: test_postgresql_development | ||
|
||
# The specified database role being used to connect to PostgreSQL. | ||
# To create additional roles in PostgreSQL see `$ createuser --help`. | ||
# When left blank, PostgreSQL will use the default role. This is | ||
# the same name as the operating system user running Rails. | ||
#username: test_postgresql | ||
|
||
# The password associated with the PostgreSQL role (username). | ||
#password: | ||
|
||
# Connect on a TCP socket. Omitted by default since the client uses a | ||
# domain socket that doesn't need configuration. Windows does not have | ||
# domain sockets, so uncomment these lines. | ||
#host: localhost | ||
|
||
# The TCP port the server listens on. Defaults to 5432. | ||
# If your server runs on a different port number, change accordingly. | ||
#port: 5432 | ||
|
||
# Schema search path. The server defaults to $user,public | ||
#schema_search_path: myapp,sharedapp,public | ||
|
||
# Minimum log levels, in increasing order: | ||
# debug5, debug4, debug3, debug2, debug1, | ||
# log, notice, warning, error, fatal, and panic | ||
# Defaults to warning. | ||
#min_messages: notice | ||
|
||
# Warning: The database defined as "test" will be erased and | ||
# re-generated from your development database when you run "rake". | ||
# Do not set this db to the same as development or production. | ||
test: | ||
<<: *default | ||
database: test_postgresql_test | ||
|
||
# As with config/credentials.yml, you never want to store sensitive information, | ||
# like your database password, in your source code. If your source code is | ||
# ever seen by anyone, they now have access to your database. | ||
# | ||
# Instead, provide the password or a full connection URL as an environment | ||
# variable when you boot the app. For example: | ||
# | ||
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" | ||
# | ||
# If the connection URL is provided in the special DATABASE_URL environment | ||
# variable, Rails will automatically merge its configuration values on top of | ||
# the values provided in this file. Alternatively, you can specify a connection | ||
# URL environment variable explicitly: | ||
# | ||
# production: | ||
# url: <%= ENV["MY_APP_DATABASE_URL"] %> | ||
# | ||
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database | ||
# for a full overview on how database connection configuration can be specified. | ||
# | ||
production: | ||
primary: &primary_production | ||
<<: *default | ||
database: test_postgresql_production | ||
username: test_postgresql | ||
password: <%= ENV["TEST_POSTGRESQL_DATABASE_PASSWORD"] %> | ||
url: <%= ENV["DATABASE_URL"] %> | ||
cache: | ||
<<: *primary_production | ||
database: test_postgresql_production_cache | ||
migrations_paths: db/cache_migrate | ||
url: <%= URI.parse(ENV["DATABASE_URL"]).tap { |url| url.path += "_cache" } if ENV["DATABASE_URL"] %> | ||
queue: | ||
<<: *primary_production | ||
database: test_postgresql_production_queue | ||
migrations_paths: db/queue_migrate | ||
url: <%= URI.parse(ENV["DATABASE_URL"]).tap { |url| url.path += "_queue" } if ENV["DATABASE_URL"] %> | ||
cable: | ||
<<: *primary_production | ||
database: test_postgresql_production_cable | ||
migrations_paths: db/cable_migrate | ||
url: <%= URI.parse(ENV["DATABASE_URL"]).tap { |url| url.path += "_cable" } if ENV["DATABASE_URL"] %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually hard breaks the generate run because not all database.yml files are valid before the erb preprocessing causing this to error.