| Index: chrome/browser/history/archived_database.cc
|
| diff --git a/chrome/browser/history/archived_database.cc b/chrome/browser/history/archived_database.cc
|
| index b5f8bfc54719ff0e0caa5baa5df5b9f3f584e522..d932a57b0c26b8986952faaf298a855015e3b377 100644
|
| --- a/chrome/browser/history/archived_database.cc
|
| +++ b/chrome/browser/history/archived_database.cc
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| @@ -13,7 +13,7 @@ namespace history {
|
|
|
| namespace {
|
|
|
| -static const int kCurrentVersionNumber = 3;
|
| +static const int kCurrentVersionNumber = 4;
|
| static const int kCompatibleVersionNumber = 2;
|
|
|
| } // namespace
|
| @@ -84,6 +84,11 @@ sql::Connection& ArchivedDatabase::GetDB() {
|
| return db_;
|
| }
|
|
|
| +// static
|
| +int ArchivedDatabase::GetCurrentVersion() {
|
| + return kCurrentVersionNumber;
|
| +}
|
| +
|
| // Migration -------------------------------------------------------------------
|
|
|
| sql::InitStatus ArchivedDatabase::EnsureCurrentVersion() {
|
| @@ -117,6 +122,17 @@ sql::InitStatus ArchivedDatabase::EnsureCurrentVersion() {
|
| meta_table_.SetVersionNumber(cur_version);
|
| }
|
|
|
| + if (cur_version == 3) {
|
| + // This is the version prior to adding the visit_duration field in visits
|
| + // database. We need to migrate the database.
|
| + if (!MigrateVisitsWithoutDuration()) {
|
| + LOG(WARNING) << "Unable to update archived database to version 4.";
|
| + return sql::INIT_FAILURE;
|
| + }
|
| + ++cur_version;
|
| + meta_table_.SetVersionNumber(cur_version);
|
| + }
|
| +
|
| // Put future migration cases here.
|
|
|
| // When the version is too old, we just try to continue anyway, there should
|
|
|