Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: chrome/browser/webdata/web_intents_table.cc

Issue 207643002: Create new Autofill tables as part of DB migration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/webdata/web_intents_table.cc
diff --git a/chrome/browser/webdata/web_intents_table.cc b/chrome/browser/webdata/web_intents_table.cc
index bb570974d0a19aa8eff615f6fdb9d30488de9552..0f97d081e5ec495fd7541a5b017f295cfe64cf5a 100644
--- a/chrome/browser/webdata/web_intents_table.cc
+++ b/chrome/browser/webdata/web_intents_table.cc
@@ -41,9 +41,7 @@ WebDatabaseTable::TypeKey WebIntentsTable::GetTypeKey() const {
return GetKey();
}
-bool WebIntentsTable::Init(sql::Connection* db, sql::MetaTable* meta_table) {
- WebDatabaseTable::Init(db, meta_table);
-
+bool WebIntentsTable::CreateTablesIfNecessary() {
if (!db_->DoesTableExist("web_intents")) {
if (!db_->Execute("CREATE TABLE web_intents ("
" service_url LONGVARCHAR,"
@@ -105,19 +103,19 @@ bool WebIntentsTable::MigrateToVersion(int version,
// Updates the table by way of renaming the old tables, rerunning
// the Init method, then selecting old values into the new tables.
bool WebIntentsTable::MigrateToVersion46AddSchemeColumn() {
+ // If the old table doesn't exist, there's nothing to migrate.
+ if (!db_->DoesTableExist("web_intents"))
+ return true;
- if (!db_->Execute("ALTER TABLE web_intents RENAME TO old_web_intents")) {
- DLOG(WARNING) << "Could not backup web_intents table.";
+ if (!db_->Execute("ALTER TABLE web_intents RENAME TO old_web_intents"))
return false;
- }
if (!db_->Execute("ALTER TABLE web_intents_defaults"
- " RENAME TO old_web_intents_defaults")) {
- DLOG(WARNING) << "Could not backup web_intents_defaults table.";
+ " RENAME TO old_web_intents_defaults"))
return false;
- }
- if (!Init(db_, meta_table_)) return false;
+ if (!CreateTablesIfNecessary())
+ return false;
int error = db_->ExecuteAndReturnErrorCode(
"INSERT INTO web_intents"
« no previous file with comments | « chrome/browser/webdata/web_intents_table.h ('k') | components/autofill/core/browser/webdata/autofill_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698