Skip to content

Drop plain-text columns from user_credit_card_validations table

Hinam Mehra requested to merge 413525-drop-plain-text-credit-card-columns into master

What does this MR do and why?

Database

db:migrate
main: == 20231213014658 RemovePlainTextCreditCardColumns: migrating =================
main: -- remove_column(:user_credit_card_validations, :holder_name)
main:    -> 0.0018s
main: -- remove_column(:user_credit_card_validations, :network)
main:    -> 0.0011s
main: -- remove_column(:user_credit_card_validations, :expiration_date)
main:    -> 0.0008s
main: -- remove_column(:user_credit_card_validations, :last_digits)
main:    -> 0.0010s
main: == 20231213014658 RemovePlainTextCreditCardColumns: migrated (0.0107s) ========
db:rollback
main: == 20231213014658 RemovePlainTextCreditCardColumns: reverting =================
main: -- add_column(:user_credit_card_validations, :holder_name, :text, {:if_not_exists=>true})
main:    -> 0.0165s
main: -- add_column(:user_credit_card_validations, :network, :text, {:if_not_exists=>true})
main:    -> 0.0023s
main: -- add_column(:user_credit_card_validations, :expiration_date, :date, {:if_not_exists=>true})
main:    -> 0.0022s
main: -- add_column(:user_credit_card_validations, :last_digits, :integer, {:limit=>2, :if_not_exists=>true})
main:    -> 0.0021s
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- execute("ALTER TABLE user_credit_card_validations\nADD CONSTRAINT check_eafe45d88b\nCHECK ( char_length(holder_name) <= 50 )\nNOT VALID;\n")
main:    -> 0.0009s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0004s
main: -- execute("ALTER TABLE user_credit_card_validations VALIDATE CONSTRAINT check_eafe45d88b;")
main:    -> 0.0007s
main: -- execute("RESET statement_timeout")
main:    -> 0.0004s
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- execute("ALTER TABLE user_credit_card_validations\nADD CONSTRAINT check_1765e2b30f\nCHECK ( char_length(network) <= 32 )\nNOT VALID;\n")
main:    -> 0.0006s
main: -- execute("ALTER TABLE user_credit_card_validations VALIDATE CONSTRAINT check_1765e2b30f;")
main:    -> 0.0006s
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- execute("ALTER TABLE user_credit_card_validations\nADD CONSTRAINT credit_card_last_digits_range\nCHECK ( last_digits BETWEEN 0 AND 9999 )\nNOT VALID;\n")
main:    -> 0.0007s
main: -- execute("ALTER TABLE user_credit_card_validations VALIDATE CONSTRAINT credit_card_last_digits_range;")
main:    -> 0.0005s
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0008s
main: -- index_exists?(:user_credit_card_validations, "lower(holder_name), expiration_date, last_digits, credit_card_validated_at", {:name=>"index_user_credit_card_validations_meta_data_full_match_lower", :algorithm=>:concurrently})
main:    -> 0.0034s
main: -- add_index(:user_credit_card_validations, "lower(holder_name), expiration_date, last_digits, credit_card_validated_at", {:name=>"index_user_credit_card_validations_meta_data_full_match_lower", :algorithm=>:concurrently})
main:    -> 0.0017s
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0007s
main: -- index_exists?(:user_credit_card_validations, "expiration_date, last_digits, network, credit_card_validated_at", {:name=>"index_user_credit_card_validations_meta_data_partial_match", :algorithm=>:concurrently})
main:    -> 0.0029s
main: -- add_index(:user_credit_card_validations, "expiration_date, last_digits, network, credit_card_validated_at", {:name=>"index_user_credit_card_validations_meta_data_partial_match", :algorithm=>:concurrently})
main:    -> 0.0012s
main: == 20231213014658 RemovePlainTextCreditCardColumns: reverted (0.0866s) ========

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #413525

Edited by Hinam Mehra

Merge request reports

Loading