| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "components/webdata/common/web_database.h" | 5 #include "components/webdata/common/web_database.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 | 8 | 
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" | 
| 10 #include "sql/transaction.h" | 10 #include "sql/transaction.h" | 
| 11 | 11 | 
| 12 // Current version number.  Note: when changing the current version number, | 12 // Current version number.  Note: when changing the current version number, | 
| 13 // corresponding changes must happen in the unit tests, and new migration test | 13 // corresponding changes must happen in the unit tests, and new migration test | 
| 14 // added.  See |WebDatabaseMigrationTest::kCurrentTestedVersionNumber|. | 14 // added.  See |WebDatabaseMigrationTest::kCurrentTestedVersionNumber|. | 
| 15 // static | 15 // static | 
| 16 const int WebDatabase::kCurrentVersionNumber = 69; | 16 const int WebDatabase::kCurrentVersionNumber = 70; | 
| 17 | 17 | 
| 18 const int WebDatabase::kDeprecatedVersionNumber = 51; | 18 const int WebDatabase::kDeprecatedVersionNumber = 51; | 
| 19 | 19 | 
| 20 namespace { | 20 namespace { | 
| 21 | 21 | 
| 22 const int kCompatibleVersionNumber = 68; | 22 const int kCompatibleVersionNumber = 70; | 
| 23 | 23 | 
| 24 // Change the version number and possibly the compatibility version of | 24 // Change the version number and possibly the compatibility version of | 
| 25 // |meta_table_|. | 25 // |meta_table_|. | 
| 26 void ChangeVersion(sql::MetaTable* meta_table, | 26 void ChangeVersion(sql::MetaTable* meta_table, | 
| 27                    int version_num, | 27                    int version_num, | 
| 28                    bool update_compatible_version_num) { | 28                    bool update_compatible_version_num) { | 
| 29   meta_table->SetVersionNumber(version_num); | 29   meta_table->SetVersionNumber(version_num); | 
| 30   if (update_compatible_version_num) { | 30   if (update_compatible_version_num) { | 
| 31     meta_table->SetCompatibleVersionNumber( | 31     meta_table->SetCompatibleVersionNumber( | 
| 32           std::min(version_num, kCompatibleVersionNumber)); | 32           std::min(version_num, kCompatibleVersionNumber)); | 
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 189 | 189 | 
| 190 bool WebDatabase::MigrateToVersion58DropWebAppsAndIntents() { | 190 bool WebDatabase::MigrateToVersion58DropWebAppsAndIntents() { | 
| 191   sql::Transaction transaction(&db_); | 191   sql::Transaction transaction(&db_); | 
| 192   return transaction.Begin() && | 192   return transaction.Begin() && | 
| 193       db_.Execute("DROP TABLE IF EXISTS web_apps") && | 193       db_.Execute("DROP TABLE IF EXISTS web_apps") && | 
| 194       db_.Execute("DROP TABLE IF EXISTS web_app_icons") && | 194       db_.Execute("DROP TABLE IF EXISTS web_app_icons") && | 
| 195       db_.Execute("DROP TABLE IF EXISTS web_intents") && | 195       db_.Execute("DROP TABLE IF EXISTS web_intents") && | 
| 196       db_.Execute("DROP TABLE IF EXISTS web_intents_defaults") && | 196       db_.Execute("DROP TABLE IF EXISTS web_intents_defaults") && | 
| 197       transaction.Commit(); | 197       transaction.Commit(); | 
| 198 } | 198 } | 
| OLD | NEW | 
|---|