mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 08:54:54 +08:00
DEV: Allow DROP NOT NULL
in pre-deploy migrations (#20775)
Our SafeMigrate system is designed to prevent tables/columns being dropped in pre-deploy migrations. Its regex-based detection was triggering incorrectly on `ALTER COLUMN DROP NOT NULL`.
This commit is contained in:
@ -70,6 +70,16 @@ RSpec.describe Migration::SafeMigrate do
|
||||
expect { User.first.username }.not_to raise_error
|
||||
end
|
||||
|
||||
it "allows dropping NOT NULL" do
|
||||
Migration::SafeMigrate.enable!
|
||||
|
||||
path = File.expand_path "#{Rails.root}/spec/fixtures/db/migrate/drop_not_null"
|
||||
|
||||
output = capture_stdout { migrate_up(path) }
|
||||
|
||||
expect(output).to include("change_column_null(:users, :username, true)")
|
||||
end
|
||||
|
||||
it "supports being disabled" do
|
||||
Migration::SafeMigrate.enable!
|
||||
Migration::SafeMigrate.disable!
|
||||
|
Reference in New Issue
Block a user