Index: components/password_manager/core/browser/login_database.cc |
diff --git a/components/password_manager/core/browser/login_database.cc b/components/password_manager/core/browser/login_database.cc |
index a9d329f3d63f36b1bbc97022500f1b0882adf7c1..93b97316ff21b5db7955231aad9bf535de417a8d 100644 |
--- a/components/password_manager/core/browser/login_database.cc |
+++ b/components/password_manager/core/browser/login_database.cc |
@@ -257,13 +257,36 @@ bool LoginDatabase::MigrateOldVersionsAsNeeded() { |
} |
meta_table_.SetVersionNumber(7); |
// Fall through. |
- case 7: |
- // Keep version 8 around even though no changes are made. See |
+ case 7: { |
+ // Remove use_additional_auth column from database schema |
Garrett Casto
2015/01/06 21:48:16
This shouldn't be here, you need to increment the
melandory
2015/01/13 12:51:15
Done.
|
// crbug.com/423716 for context. |
+ std::string fields_to_copy = |
+ "origin_url, action_url, username_element, username_value, " |
+ "password_element, password_value, submit_element, " |
+ "signon_realm, ssl_valid, preferred, date_created, " |
+ "blacklisted_by_user, " |
+ "scheme, password_type, possible_usernames, times_used, form_data, " |
+ "date_synced, display_name, avatar_url," |
+ "federation_url, is_zero_click"; |
+ auto copy_data_from_to_query = |
Garrett Casto
2015/01/06 21:48:16
I would just call this "copy_data_query". I can se
melandory
2015/01/13 12:51:15
Done.
|
+ [&fields_to_copy](std::string from, std::string to) { |
+ return ("INSERT INTO " + to + " SELECT " + fields_to_copy + " FROM " + |
+ from).c_str(); |
+ }; |
Garrett Casto
2015/01/06 21:48:16
Nit: Whitespace here.
melandory
2015/01/13 12:51:15
Done.
|
+ if (!db_.Execute(("CREATE TEMPORARY TABLE logins_data(" + fields_to_copy + |
+ ")").c_str()) || |
+ !db_.Execute( |
+ copy_data_from_to_query("logins", "logins_data")) || |
+ !db_.Execute("DROP TABLE logins") || |
+ !db_.Execute( |
+ ("CREATE TABLE logins(" + fields_to_copy + ")").c_str()) || |
+ !db_.Execute( |
+ copy_data_from_to_query("logins_data", "logins")) || |
+ !db_.Execute("DROP TABLE logins_data")) |
Garrett Casto
2015/01/06 21:48:16
You need to recreate the index on logins as well.
|
+ return false; |
meta_table_.SetVersionNumber(8); |
// Fall through. |
- // TODO(gcasto): Remove use_additional_auth by copying table. |
- // https://www.sqlite.org/lang_altertable.html |
+ } |
case 8: { |
sql::Statement s; |
s.Assign(db_.GetCachedStatement(SQL_FROM_HERE, |