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

Unified Diff: trunk/src/chrome/browser/history/shortcuts_database.cc

Issue 163613012: Revert 251442 "Migrate old Shortcuts DB data to conform to new t..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 10 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: trunk/src/chrome/browser/history/shortcuts_database.cc
===================================================================
--- trunk/src/chrome/browser/history/shortcuts_database.cc (revision 251472)
+++ trunk/src/chrome/browser/history/shortcuts_database.cc (working copy)
@@ -11,18 +11,11 @@
#include "base/logging.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
-#include "sql/meta_table.h"
#include "sql/statement.h"
#include "sql/transaction.h"
namespace {
-// Current version number. We write databases at the "current" version number,
-// but any previous version that can read the "compatible" one can make do with
-// our database without *too* many bad effects.
-const int kCurrentVersionNumber = 1;
-const int kCompatibleVersionNumber = 1;
-
void BindShortcutToStatement(
const history::ShortcutsBackend::Shortcut& shortcut,
sql::Statement* s) {
@@ -184,7 +177,8 @@
// Perform the upgrade in a transaction to ensure it doesn't happen
// incompletely.
sql::Transaction transaction(&db_);
- if (!(transaction.Begin() &&
+ transaction.Begin();
+ return
db_.Execute("ALTER TABLE omni_box_shortcuts "
"ADD COLUMN fill_into_edit VARCHAR") &&
db_.Execute("UPDATE omni_box_shortcuts SET fill_into_edit = url") &&
@@ -199,31 +193,9 @@
static_cast<int>(AutocompleteMatchType::HISTORY_TITLE)).c_str()) &&
db_.Execute("ALTER TABLE omni_box_shortcuts "
"ADD COLUMN keyword VARCHAR") &&
- transaction.Commit())) {
- return false;
- }
+ transaction.Commit();
}
- if (!sql::MetaTable::DoesTableExist(&db_)) {
- meta_table_.Init(&db_, kCurrentVersionNumber, kCompatibleVersionNumber);
- sql::Transaction transaction(&db_);
- if (!(transaction.Begin() &&
- // Migrate old SEARCH_OTHER_ENGINE values to the new type value.
- db_.Execute(base::StringPrintf("UPDATE omni_box_shortcuts "
- "SET type = 13 WHERE type = 9").c_str()) &&
- // Migrate old EXTENSION_APP values to the new type value.
- db_.Execute(base::StringPrintf("UPDATE omni_box_shortcuts "
- "SET type = 14 WHERE type = 10").c_str()) &&
- // Migrate old CONTACT values to the new type value.
- db_.Execute(base::StringPrintf("UPDATE omni_box_shortcuts "
- "SET type = 15 WHERE type = 11").c_str()) &&
- // Migrate old BOOKMARK_TITLE values to the new type value.
- db_.Execute(base::StringPrintf("UPDATE omni_box_shortcuts "
- "SET type = 16 WHERE type = 12").c_str()) &&
- transaction.Commit())) {
- return false;
- }
- }
return true;
}
« no previous file with comments | « trunk/src/chrome/browser/history/shortcuts_database.h ('k') | trunk/src/chrome/browser/history/shortcuts_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698