debian-mirror-gitlab/db/migrate/20211210025754_alter_constraint_of_phone.rb

18 lines
658 B
Ruby
Raw Normal View History

2022-03-02 08:16:31 +05:30
# 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