diff options
Diffstat (limited to 'db/migrate/20240115115029_add_rate_limits_hash_constraint_to_application_settings.rb')
-rw-r--r-- | db/migrate/20240115115029_add_rate_limits_hash_constraint_to_application_settings.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/db/migrate/20240115115029_add_rate_limits_hash_constraint_to_application_settings.rb b/db/migrate/20240115115029_add_rate_limits_hash_constraint_to_application_settings.rb new file mode 100644 index 00000000000..14ab736b5d2 --- /dev/null +++ b/db/migrate/20240115115029_add_rate_limits_hash_constraint_to_application_settings.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddRateLimitsHashConstraintToApplicationSettings < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + milestone '16.9' + + CONSTRAINT_NAME = 'check_application_settings_rate_limits_is_hash' + + def up + add_check_constraint( + :application_settings, + "(jsonb_typeof(rate_limits) = 'object')", + CONSTRAINT_NAME + ) + end + + def down + remove_check_constraint :application_settings, CONSTRAINT_NAME + end +end |