Don't assume postgresql in two initializers
This commit is contained in:
parent
69a3af733e
commit
564306e028
2 changed files with 48 additions and 44 deletions
|
@ -1,15 +1,16 @@
|
||||||
raise "Vendored ActiveRecord 5 code! Delete #{__FILE__}!" if ActiveRecord::VERSION::MAJOR >= 5
|
raise "Vendored ActiveRecord 5 code! Delete #{__FILE__}!" if ActiveRecord::VERSION::MAJOR >= 5
|
||||||
|
|
||||||
require 'active_record/connection_adapters/postgresql_adapter'
|
if Gitlab::Database.postgresql?
|
||||||
require 'active_record/connection_adapters/postgresql/schema_statements'
|
require 'active_record/connection_adapters/postgresql_adapter'
|
||||||
|
require 'active_record/connection_adapters/postgresql/schema_statements'
|
||||||
|
|
||||||
#
|
#
|
||||||
# Monkey-patch the refused Rails 4.2 patch at https://github.com/rails/rails/pull/31330
|
# Monkey-patch the refused Rails 4.2 patch at https://github.com/rails/rails/pull/31330
|
||||||
#
|
#
|
||||||
# Updates sequence logic to support PostgreSQL 10.
|
# Updates sequence logic to support PostgreSQL 10.
|
||||||
#
|
#
|
||||||
# rubocop:disable all
|
# rubocop:disable all
|
||||||
module ActiveRecord
|
module ActiveRecord
|
||||||
module ConnectionAdapters
|
module ConnectionAdapters
|
||||||
|
|
||||||
# We need #postgresql_version to be public as in ActiveRecord 5 for seed_fu
|
# We need #postgresql_version to be public as in ActiveRecord 5 for seed_fu
|
||||||
|
@ -53,5 +54,6 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
# rubocop:enable all
|
||||||
end
|
end
|
||||||
# rubocop:enable all
|
|
||||||
|
|
|
@ -7,10 +7,12 @@ if Gitlab::Database.mysql?
|
||||||
require 'peek-mysql2'
|
require 'peek-mysql2'
|
||||||
PEEK_DB_CLIENT = ::Mysql2::Client
|
PEEK_DB_CLIENT = ::Mysql2::Client
|
||||||
PEEK_DB_VIEW = Peek::Views::Mysql2
|
PEEK_DB_VIEW = Peek::Views::Mysql2
|
||||||
else
|
elsif Gitlab::Database.postgresql?
|
||||||
require 'peek-pg'
|
require 'peek-pg'
|
||||||
PEEK_DB_CLIENT = ::PG::Connection
|
PEEK_DB_CLIENT = ::PG::Connection
|
||||||
PEEK_DB_VIEW = Peek::Views::PG
|
PEEK_DB_VIEW = Peek::Views::PG
|
||||||
|
else
|
||||||
|
raise "Unsupported database adapter for peek!"
|
||||||
end
|
end
|
||||||
|
|
||||||
Peek.into PEEK_DB_VIEW
|
Peek.into PEEK_DB_VIEW
|
||||||
|
|
Loading…
Reference in a new issue