diff options
Diffstat (limited to 'chrome/browser/history/history_database.cc')
-rw-r--r-- | chrome/browser/history/history_database.cc | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/chrome/browser/history/history_database.cc b/chrome/browser/history/history_database.cc index 7869fcc..4fab291 100644 --- a/chrome/browser/history/history_database.cc +++ b/chrome/browser/history/history_database.cc @@ -26,7 +26,7 @@ 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 // or database without *too* many bad effects. -static const int kCurrentVersionNumber = 18; +static const int kCurrentVersionNumber = 19; static const int kCompatibleVersionNumber = 16; static const char kEarlyExpirationThresholdKey[] = "early_expiration_threshold"; @@ -134,7 +134,7 @@ void HistoryDatabase::BeginExclusiveMode() { // static int HistoryDatabase::GetCurrentVersion() { - // If we don't use TopSites, we are one version number behind. + // If we don't use TopSites, we stay at the last pre-TopSites version. if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoTopSites)) return 17; // Last pre-TopSites version. else @@ -284,12 +284,19 @@ sql::InitStatus HistoryDatabase::EnsureCurrentVersion( needs_version_18_migration_ = true; if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoTopSites) && - cur_version == 18) { + (cur_version == 18 || cur_version == 19)) { // Set DB version back to pre-top sites. cur_version = 17; meta_table_.SetVersionNumber(cur_version); } + if (needs_version_18_migration_ || cur_version == 18) { + // This is the version prior to adding url_source column. We need to + // migrate the database. + cur_version = 19; + meta_table_.SetVersionNumber(cur_version); + } + // When the version is too old, we just try to continue anyway, there should // not be a released product that makes a database too old for us to handle. LOG_IF(WARNING, (cur_version < GetCurrentVersion() && @@ -325,9 +332,13 @@ void HistoryDatabase::MigrateTimeEpoch() { #endif void HistoryDatabase::MigrationToTopSitesDone() { - // We should be migrating from 17 to 18. - DCHECK_EQ(17, meta_table_.GetVersionNumber()); - meta_table_.SetVersionNumber(18); + // Migration should only happen for version 17 and 19. + int version = meta_table_.GetVersionNumber(); + DCHECK(17 == version || 19 == version); + if (17 == version) { + // We should be migrating from 17 to 18. + meta_table_.SetVersionNumber(18); + } needs_version_18_migration_ = false; } |