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/20220310101118_update_holder_name_limit.rb')
-rw-r--r--db/migrate/20220310101118_update_holder_name_limit.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/db/migrate/20220310101118_update_holder_name_limit.rb b/db/migrate/20220310101118_update_holder_name_limit.rb
new file mode 100644
index 00000000000..55eb8f75d70
--- /dev/null
+++ b/db/migrate/20220310101118_update_holder_name_limit.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+# See https://docs.gitlab.com/ee/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class UpdateHolderNameLimit < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :user_credit_card_validations, :holder_name, 50, constraint_name: new_constraint_name
+ remove_text_limit :user_credit_card_validations, :holder_name, constraint_name: old_constraint_name
+ end
+
+ def down
+ add_text_limit :user_credit_card_validations, :holder_name, 26, validate: false, constraint_name: old_constraint_name
+ remove_text_limit :user_credit_card_validations, :holder_name, constraint_name: new_constraint_name
+ end
+
+ private
+
+ def old_constraint_name
+ check_constraint_name(:user_credit_card_validations, :holder_name, 'max_length')
+ end
+
+ def new_constraint_name
+ check_constraint_name(:user_credit_card_validations, :holder_name, 'max_length_50')
+ end
+end