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
33b3457a9f
commit
959c4e9224
3 changed files with 4 additions and 4 deletions
|
@ -6,7 +6,7 @@ class Admin::SystemCheck::DatabaseSchemaCheck < Admin::SystemCheck::BaseCheck
|
||||||
end
|
end
|
||||||
|
|
||||||
def pass?
|
def pass?
|
||||||
!ActiveRecord::Base.connection.migration_context.needs_migration?
|
!ActiveRecord::Base.connection_pool.migration_context.needs_migration?
|
||||||
end
|
end
|
||||||
|
|
||||||
def message
|
def message
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace :tests do
|
||||||
'3_3_0' => 2020_12_18_054746,
|
'3_3_0' => 2020_12_18_054746,
|
||||||
}.each do |release, version|
|
}.each do |release, version|
|
||||||
ActiveRecord::Tasks::DatabaseTasks
|
ActiveRecord::Tasks::DatabaseTasks
|
||||||
.migration_connection
|
.migration_connection_pool
|
||||||
.migration_context
|
.migration_context
|
||||||
.migrate(version)
|
.migrate(version)
|
||||||
Rake::Task["tests:migrations:populate_v#{release}"]
|
Rake::Task["tests:migrations:populate_v#{release}"]
|
||||||
|
|
|
@ -13,7 +13,7 @@ describe Admin::SystemCheck::DatabaseSchemaCheck do
|
||||||
context 'when database needs migration' do
|
context 'when database needs migration' do
|
||||||
before do
|
before do
|
||||||
context = instance_double(ActiveRecord::MigrationContext, needs_migration?: true)
|
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
|
end
|
||||||
|
|
||||||
it 'returns false' do
|
it 'returns false' do
|
||||||
|
@ -24,7 +24,7 @@ describe Admin::SystemCheck::DatabaseSchemaCheck do
|
||||||
context 'when database does not need migration' do
|
context 'when database does not need migration' do
|
||||||
before do
|
before do
|
||||||
context = instance_double(ActiveRecord::MigrationContext, needs_migration?: false)
|
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
|
end
|
||||||
|
|
||||||
it 'returns true' do
|
it 'returns true' do
|
||||||
|
|
Loading…
Reference in a new issue