diff options
Diffstat (limited to 'db/migrate/20200513160930_fix_not_null_check_constraint_inconsistency.rb')
-rw-r--r-- | db/migrate/20200513160930_fix_not_null_check_constraint_inconsistency.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/db/migrate/20200513160930_fix_not_null_check_constraint_inconsistency.rb b/db/migrate/20200513160930_fix_not_null_check_constraint_inconsistency.rb new file mode 100644 index 00000000000..a8bb91cf6cf --- /dev/null +++ b/db/migrate/20200513160930_fix_not_null_check_constraint_inconsistency.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class FixNotNullCheckConstraintInconsistency < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + table = :application_settings + + %i(container_registry_vendor container_registry_version).each do |column| + change_column_null table, column, false + remove_not_null_constraint(table, column) if check_not_null_constraint_exists?(table, column) + end + end + + def down + # No-op: for regular systems without the inconsistency, #up is a no-op, too + end +end |