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,7 +2,6 @@
# PRODUCTION
#
production:
main:
adapter: postgresql
encoding: unicode
database: gitlabhq_production
......@@ -23,7 +22,6 @@ production:
# Development specific
#
development:
main:
adapter: postgresql
encoding: unicode
database: gitlabhq_development
......@@ -37,7 +35,6 @@ development:
# Staging specific
#
staging:
main:
adapter: postgresql
encoding: unicode
database: gitlabhq_staging
......@@ -49,7 +46,6 @@ staging:
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test: &test
main:
adapter: postgresql
encoding: unicode
database: gitlabhq_test
......
......@@ -76,7 +76,11 @@ module Gitlab
# The database is `main` if it is a first entry in `database.yml`
# Rails internally names them `primary` to avoid confusion
# 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
def self.ci_database?(name)
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
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 }
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