-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make database.yml actually use all the db engines on CI
- Loading branch information
Showing
1 changed file
with
31 additions
and
19 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,37 @@ | ||
# SQLite. Versions 3.8.0 and up are supported. | ||
# gem install sqlite3 | ||
# | ||
# Ensure the SQLite 3 gem is defined in your Gemfile | ||
# gem "sqlite3" | ||
# | ||
default: &default | ||
adapter: sqlite3 | ||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> | ||
timeout: 5000 | ||
<% | ||
db_adapter = ENV.fetch('DB', 'sqlite3') | ||
db_host = ENV.fetch('DB_HOST', ENV.fetch('DB_1_PORT_5432_TCP_ADDR', 'localhost')) | ||
db_port = ENV['DB_1_PORT_5432_TCP_PORT'] || ENV['DB_PORT'] || | ||
{'postgresql' => 5432, 'mysql2' => 3306}[db_adapter] | ||
require 'etc' | ||
db_pool_size = ENV['DB_POOL'] || ( | ||
# Web: max workers * max threads | ||
ENV.fetch('WEB_CONCURRENCY', 3).to_i * ENV.fetch('MAX_THREADS', 5).to_i + | ||
# ActiveJob Async max thread pool size | ||
Etc.nprocessors | ||
) | ||
%> | ||
|
||
defaults: &defaults | ||
host: <%= db_host %> | ||
port: <%= db_port %> | ||
adapter: <%= db_adapter %> | ||
min_messages: WARNING | ||
pool: <%= db_pool_size %> | ||
username: <%= ENV.fetch('DB_USERNAME', 'inner_performance').inspect %> | ||
password: <%= ENV.fetch('DB_PASSWORD', 'inner_performance').inspect %> | ||
|
||
development: | ||
<<: *default | ||
database: storage/development.sqlite3 | ||
<<: *defaults | ||
database: <%= db_adapter == 'sqlite3' ? ENV.fetch('DATABASE_FILE', 'db/development.sqlite3') : 'inner_performance_dev' %> | ||
|
||
# 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: storage/test.sqlite3 | ||
<<: *defaults | ||
database: <%= db_adapter == 'sqlite3' ? ENV.fetch('DATABASE_FILE', 'db/test.sqlite3') : 'inner_performance_test' %> | ||
|
||
production: | ||
<<: *default | ||
database: storage/production.sqlite3 | ||
<<: *defaults | ||
encoding: utf8 | ||
min_messages: WARNING | ||
url: <%= ENV['DATABASE_URL'].inspect if ENV['DATABASE_URL'] %> | ||
database: <%= (db_adapter == 'sqlite3' ? 'db/production.sqlite3' : 'inner_performance_production') unless ENV['DATABASE_URL'] %> |