| Index: components/autofill/core/browser/webdata/autofill_table.cc
|
| diff --git a/components/autofill/core/browser/webdata/autofill_table.cc b/components/autofill/core/browser/webdata/autofill_table.cc
|
| index 27d1c00d4702a2baa398de4bf121cd522b929903..d31e6b19cfa88c4ea29a7d8f3e3a1d0754ebdcdf 100644
|
| --- a/components/autofill/core/browser/webdata/autofill_table.cc
|
| +++ b/components/autofill/core/browser/webdata/autofill_table.cc
|
| @@ -483,6 +483,9 @@ bool AutofillTable::MigrateToVersion(int version,
|
| case 71:
|
| *update_compatible_version = true;
|
| return MigrateToVersion71AddHasConvertedAndBillingAddressIdMetadata();
|
| + case 72:
|
| + *update_compatible_version = true;
|
| + return MigrateToVersion72AddMaskedCardBankName();
|
| }
|
| return true;
|
| }
|
| @@ -1239,7 +1242,8 @@ bool AutofillTable::GetServerCreditCards(
|
| "name_on_card," // 7
|
| "exp_month," // 8
|
| "exp_year," // 9
|
| - "metadata.billing_address_id " // 10
|
| + "metadata.billing_address_id," // 10
|
| + "bank_name " // 11
|
| "FROM masked_credit_cards masked "
|
| "LEFT OUTER JOIN unmasked_credit_cards USING (id) "
|
| "LEFT OUTER JOIN server_card_metadata metadata USING (id)"));
|
| @@ -1282,6 +1286,7 @@ bool AutofillTable::GetServerCreditCards(
|
| card->SetRawInfo(CREDIT_CARD_EXP_MONTH, s.ColumnString16(index++));
|
| card->SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, s.ColumnString16(index++));
|
| card->set_billing_address_id(s.ColumnString(index++));
|
| + card->SetBankName(s.ColumnString(index++));
|
| credit_cards->push_back(std::move(card));
|
| }
|
|
|
| @@ -1307,8 +1312,9 @@ void AutofillTable::SetServerCreditCards(
|
| "name_on_card," // 3
|
| "last_four," // 4
|
| "exp_month," // 5
|
| - "exp_year)" // 6
|
| - "VALUES (?,?,?,?,?,?,?)"));
|
| + "exp_year," // 6
|
| + "bank_name)" // 7
|
| + "VALUES (?,?,?,?,?,?,?,?)"));
|
| for (const CreditCard& card : credit_cards) {
|
| DCHECK_EQ(CreditCard::MASKED_SERVER_CARD, card.record_type());
|
|
|
| @@ -1321,6 +1327,7 @@ void AutofillTable::SetServerCreditCards(
|
| masked_insert.BindString16(5, card.GetRawInfo(CREDIT_CARD_EXP_MONTH));
|
| masked_insert.BindString16(6,
|
| card.GetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR));
|
| + masked_insert.BindString(7, card.bank_name());
|
|
|
| masked_insert.Run();
|
| masked_insert.Reset(true);
|
| @@ -1934,7 +1941,8 @@ bool AutofillTable::InitMaskedCreditCardsTable() {
|
| "type VARCHAR,"
|
| "last_four VARCHAR,"
|
| "exp_month INTEGER DEFAULT 0,"
|
| - "exp_year INTEGER DEFAULT 0)")) {
|
| + "exp_year INTEGER DEFAULT 0,"
|
| + " bank_name VARCHAR)")) {
|
| NOTREACHED();
|
| return false;
|
| }
|
| @@ -2542,4 +2550,19 @@ bool AutofillTable::
|
| return transaction.Commit();
|
| }
|
|
|
| +bool AutofillTable::MigrateToVersion72AddMaskedCardBankName() {
|
| + sql::Transaction transaction(db_);
|
| + if (!transaction.Begin())
|
| + return false;
|
| +
|
| + // Add the new bank_name column to the masked_credit_cards table.
|
| + if (!db_->DoesColumnExist("masked_credit_cards", "bank_name") &&
|
| + !db_->Execute("ALTER TABLE masked_credit_cards ADD COLUMN "
|
| + "bank_name VARCHAR")) {
|
| + return false;
|
| + }
|
| +
|
| + return transaction.Commit();
|
| +}
|
| +
|
| } // namespace autofill
|
|
|