mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Moved migration_context
method to connection pool
This commit is contained in:
parent
392657f545
commit
25cb8c3a99
3 changed files with 4 additions and 4 deletions
|
@ -6,7 +6,7 @@ class Admin::SystemCheck::DatabaseSchemaCheck < Admin::SystemCheck::BaseCheck
|
|||
end
|
||||
|
||||
def pass?
|
||||
!ActiveRecord::Base.connection.migration_context.needs_migration?
|
||||
!ActiveRecord::Base.connection_pool.migration_context.needs_migration?
|
||||
end
|
||||
|
||||
def message
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace :tests do
|
|||
'3_3_0' => 2020_12_18_054746,
|
||||
}.each do |release, version|
|
||||
ActiveRecord::Tasks::DatabaseTasks
|
||||
.migration_connection
|
||||
.migration_connection_pool
|
||||
.migration_context
|
||||
.migrate(version)
|
||||
Rake::Task["tests:migrations:populate_v#{release}"]
|
||||
|
|
|
@ -13,7 +13,7 @@ describe Admin::SystemCheck::DatabaseSchemaCheck do
|
|||
context 'when database needs migration' do
|
||||
before do
|
||||
context = instance_double(ActiveRecord::MigrationContext, needs_migration?: true)
|
||||
allow(ActiveRecord::Base.connection).to receive(:migration_context).and_return(context)
|
||||
allow(ActiveRecord::Base.connection_pool).to receive(:migration_context).and_return(context)
|
||||
end
|
||||
|
||||
it 'returns false' do
|
||||
|
@ -24,7 +24,7 @@ describe Admin::SystemCheck::DatabaseSchemaCheck do
|
|||
context 'when database does not need migration' do
|
||||
before do
|
||||
context = instance_double(ActiveRecord::MigrationContext, needs_migration?: false)
|
||||
allow(ActiveRecord::Base.connection).to receive(:migration_context).and_return(context)
|
||||
allow(ActiveRecord::Base.connection_pool).to receive(:migration_context).and_return(context)
|
||||
end
|
||||
|
||||
it 'returns true' do
|
||||
|
|
Loading…
Reference in a new issue