Commit e32fb0f9 authored by Kamil Trzciński's avatar Kamil Trzciński Committed by Thong Kuah

Revert changes to config/database.yml.postgresql

This is temporary change to ensure
that application works properly
till we start using `main:` everywhere
parent 1d0a5ada
...@@ -2,60 +2,56 @@ ...@@ -2,60 +2,56 @@
# PRODUCTION # PRODUCTION
# #
production: production:
main: adapter: postgresql
adapter: postgresql encoding: unicode
encoding: unicode database: gitlabhq_production
database: gitlabhq_production username: git
username: git password: "secure password"
password: "secure password" host: localhost
host: localhost # load_balancing:
# load_balancing: # hosts:
# hosts: # - host1.example.com
# - host1.example.com # - host2.example.com
# - host2.example.com # discover:
# discover: # nameserver: 1.2.3.4
# nameserver: 1.2.3.4 # port: 8600
# port: 8600 # record: secondary.postgresql.service.consul
# record: secondary.postgresql.service.consul # interval: 300
# interval: 300
# #
# Development specific # Development specific
# #
development: development:
main: adapter: postgresql
adapter: postgresql encoding: unicode
encoding: unicode database: gitlabhq_development
database: gitlabhq_development username: postgres
username: postgres password: "secure password"
password: "secure password" host: localhost
host: localhost variables:
variables: statement_timeout: 15s
statement_timeout: 15s
# #
# Staging specific # Staging specific
# #
staging: staging:
main: adapter: postgresql
adapter: postgresql encoding: unicode
encoding: unicode database: gitlabhq_staging
database: gitlabhq_staging username: git
username: git password: "secure password"
password: "secure password" host: localhost
host: localhost
# Warning: The database defined as "test" will be erased and # Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake". # re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production. # Do not set this db to the same as development or production.
test: &test test: &test
main: adapter: postgresql
adapter: postgresql encoding: unicode
encoding: unicode database: gitlabhq_test
database: gitlabhq_test username: postgres
username: postgres password:
password: host: localhost
host: localhost prepared_statements: false
prepared_statements: false variables:
variables: statement_timeout: 15s
statement_timeout: 15s
...@@ -76,7 +76,11 @@ module Gitlab ...@@ -76,7 +76,11 @@ module Gitlab
# The database is `main` if it is a first entry in `database.yml` # The database is `main` if it is a first entry in `database.yml`
# Rails internally names them `primary` to avoid confusion # Rails internally names them `primary` to avoid confusion
# with broad `primary` usage we use `main` instead # with broad `primary` usage we use `main` instead
ActiveRecord::Base.configurations.primary?(name.to_s) #
# TODO: The explicit `== 'main'` is needed in a transition period till
# the `database.yml` is not migrated into `main:` syntax
# https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65243
ActiveRecord::Base.configurations.primary?(name.to_s) || name.to_s == 'main'
end end
def self.ci_database?(name) def self.ci_database?(name)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Gitlab::Database::PostgresqlAdapter::TypeMapCache do RSpec.describe Gitlab::Database::PostgresqlAdapter::TypeMapCache do
let(:db_config) { ActiveRecord::Base.configurations.configs_for(env_name: 'test', name: 'main').configuration_hash } let(:db_config) { ActiveRecord::Base.configurations.find_db_config(env_name: 'test').configuration_hash }
let(:adapter_class) { ActiveRecord::ConnectionAdapters::PostgreSQLAdapter } let(:adapter_class) { ActiveRecord::ConnectionAdapters::PostgreSQLAdapter }
before do before do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment