diff --git a/db/migrate/20230510155712_add_not_null_to_exclusive_lists.rb b/db/migrate/20230510155712_add_not_null_to_exclusive_lists.rb index 053dac72f7c13c..f417e122c175b6 100644 --- a/db/migrate/20230510155712_add_not_null_to_exclusive_lists.rb +++ b/db/migrate/20230510155712_add_not_null_to_exclusive_lists.rb @@ -1,6 +1,5 @@ class AddNotNullToExclusiveLists < ActiveRecord::Migration[7.0] - - def up - change_column_null :lists, :exclusive, false + def change + add_check_constraint :lists, "exclusive IS NOT NULL", name: "lists_exclusive_null", validate: false end end diff --git a/db/migrate/20230510155713_check_not_null_exclusive_lists.rb b/db/migrate/20230510155713_check_not_null_exclusive_lists.rb new file mode 100644 index 00000000000000..ca27021cd28292 --- /dev/null +++ b/db/migrate/20230510155713_check_not_null_exclusive_lists.rb @@ -0,0 +1,5 @@ +class CheckNotNullExclusiveLists < ActiveRecord::Migration[7.0] + def change + validate_check_constraint :lists, name: "lists_exclusive_null" + end +end