From 3e7129e4f75fe4fc9367d22bac27c781812dcd77 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Fri, 8 Nov 2024 16:39:46 -0800 Subject: [PATCH] Added test for check_down with safety_assured --- test/check_down_test.rb | 8 ++++++++ test/migrations/check_down.rb | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/test/check_down_test.rb b/test/check_down_test.rb index 3b0f8a71..7a10bca4 100644 --- a/test/check_down_test.rb +++ b/test/check_down_test.rb @@ -35,6 +35,14 @@ def test_change_safe end end + def test_safety_assured + migrate CheckDownSafetyAssured + with_check_down do + assert_unsafe CheckDownSafetyAssured, direction: :down + end + assert_safe CheckDownSafetyAssured, direction: :down + end + def test_add_column migrate AddColumnDefault with_check_down do diff --git a/test/migrations/check_down.rb b/test/migrations/check_down.rb index 015e426b..a6ea90ed 100644 --- a/test/migrations/check_down.rb +++ b/test/migrations/check_down.rb @@ -37,3 +37,11 @@ def change remove_index :users, column: :name, algorithm: :concurrently end end + +class CheckDownSafetyAssured < TestMigration + def change + safety_assured do + add_column :users, :age, :integer + end + end +end