mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 03:38:05 +08:00
FIX: Allow post migrations using #change
to carry out unsafe migration
This commit is contained in:
@ -99,18 +99,28 @@ describe Migration::SafeMigrate do
|
||||
end
|
||||
|
||||
describe 'for a post deployment migration' do
|
||||
it 'should not ban unsafe migrations' do
|
||||
user = Fabricate(:user)
|
||||
it 'should not ban unsafe migrations using up' do
|
||||
Migration::SafeMigrate::SafeMigration.enable_safe!
|
||||
|
||||
path = File.expand_path "#{Rails.root}/spec/fixtures/db/post_migrate"
|
||||
path = File.expand_path "#{Rails.root}/spec/fixtures/db/post_migrate/drop_table"
|
||||
|
||||
output = capture_stdout do
|
||||
migrate_up(path)
|
||||
end
|
||||
|
||||
expect(output).to include("drop_table(:email_logs)")
|
||||
end
|
||||
|
||||
it 'should not ban unsafe migrations using change' do
|
||||
Migration::SafeMigrate::SafeMigration.enable_safe!
|
||||
|
||||
path = File.expand_path "#{Rails.root}/spec/fixtures/db/post_migrate/change"
|
||||
|
||||
output = capture_stdout do
|
||||
migrate_up(path)
|
||||
end
|
||||
|
||||
expect(output).to include("drop_table(:email_logs)")
|
||||
expect(user.reload).to eq(user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user