summaryrefslogtreecommitdiff
path: root/db/migrate/20211210025754_alter_constraint_of_phone.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20211210025754_alter_constraint_of_phone.rb')
-rw-r--r--db/migrate/20211210025754_alter_constraint_of_phone.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20211210025754_alter_constraint_of_phone.rb b/db/migrate/20211210025754_alter_constraint_of_phone.rb
new file mode 100644
index 00000000000..1644fbe9000
--- /dev/null
+++ b/db/migrate/20211210025754_alter_constraint_of_phone.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AlterConstraintOfPhone < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ constraint_phone = check_constraint_name('verification_codes', 'phone', 'max_length')
+ remove_check_constraint(:verification_codes, constraint_phone)
+ add_check_constraint(:verification_codes, 'char_length(phone) <= 50', constraint_phone)
+ end
+
+ def down
+ constraint_phone = check_constraint_name('verification_codes', 'phone', 'max_length')
+ remove_check_constraint(:verification_codes, constraint_phone)
+ add_check_constraint(:verification_codes, 'char_length(phone) <= 32', constraint_phone)
+ end
+end