default: &default adapter: sqlite3 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> timeout: 10_000 # milliseconds pragmas: cache_size: 20_000 # Keeps more pages in memory, improving read performance. extensions: - SQLean::Text - SQLean::Time - SQLean::Unicode tenants: &tenants <% tenants = YAML.load_file(Rails.root.join("config", "tenant.yml"), aliases: true)[Rails.env].keys %> <% tenants.each_with_index do |tenant, index| %> <%= tenant %>: <<: *default database: storage/<%= "#{Rails.env}_#{tenant}" %>.sqlite3 migrations_paths: db/migrate schema_dump: <%= index == 0 || Rails.env.test? ? "schema.rb" : false %> <% end %> development: <<: *tenants test: <<: *tenants production: queue: <<: *default database: storage/production_queue.sqlite3 migrations_paths: db/queue_migrate pragmas: auto_vacuum: full <<: *tenants