Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20230830084959_validate_push_rules_constraints.rb')
-rw-r--r--db/migrate/20230830084959_validate_push_rules_constraints.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/db/migrate/20230830084959_validate_push_rules_constraints.rb b/db/migrate/20230830084959_validate_push_rules_constraints.rb
new file mode 100644
index 00000000000..99b5d680642
--- /dev/null
+++ b/db/migrate/20230830084959_validate_push_rules_constraints.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class ValidatePushRulesConstraints < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ REGEX_COLUMNS = %i[
+ force_push_regex
+ delete_branch_regex
+ commit_message_regex
+ commit_message_negative_regex
+ author_email_regex
+ file_name_regex
+ branch_name_regex
+ ].freeze
+
+ def up
+ REGEX_COLUMNS.each do |column_name|
+ validate_check_constraint :push_rules, "#{column_name}_size_constraint"
+ end
+ end
+
+ def down
+ # No op
+ end
+end