| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/webdata/web_database.h" | 5 #include "chrome/browser/webdata/web_database.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/sql/statement.h" | 9 #include "app/sql/statement.h" |
| 10 #include "app/sql/transaction.h" | 10 #include "app/sql/transaction.h" |
| 11 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" | 11 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" |
| 12 #include "content/common/notification_service.h" | 12 #include "content/common/notification_service.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 // Current version number. Note: when changing the current version number, | 16 // Current version number. Note: when changing the current version number, |
| 17 // corresponding changes must happen in the unit tests, and new migration test | 17 // corresponding changes must happen in the unit tests, and new migration test |
| 18 // added. See |WebDatabaseMigrationTest::kCurrentTestedVersionNumber|. | 18 // added. See |WebDatabaseMigrationTest::kCurrentTestedVersionNumber|. |
| 19 const int kCurrentVersionNumber = 37; | 19 const int kCurrentVersionNumber = 38; |
| 20 const int kCompatibleVersionNumber = 37; | 20 const int kCompatibleVersionNumber = 38; |
| 21 | 21 |
| 22 // Change the version number and possibly the compatibility version of | 22 // Change the version number and possibly the compatibility version of |
| 23 // |meta_table_|. | 23 // |meta_table_|. |
| 24 void ChangeVersion(sql::MetaTable* meta_table, | 24 void ChangeVersion(sql::MetaTable* meta_table, |
| 25 int version_num, | 25 int version_num, |
| 26 bool update_compatible_version_num) { | 26 bool update_compatible_version_num) { |
| 27 meta_table->SetVersionNumber(version_num); | 27 meta_table->SetVersionNumber(version_num); |
| 28 if (update_compatible_version_num) { | 28 if (update_compatible_version_num) { |
| 29 meta_table->SetCompatibleVersionNumber( | 29 meta_table->SetCompatibleVersionNumber( |
| 30 std::min(version_num, kCompatibleVersionNumber)); | 30 std::min(version_num, kCompatibleVersionNumber)); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 // directly getting the full benefits of the multi-valued merge as well as | 272 // directly getting the full benefits of the multi-valued merge as well as |
| 273 // the culling of bad data. | 273 // the culling of bad data. |
| 274 case 35: | 274 case 35: |
| 275 case 36: | 275 case 36: |
| 276 if (!autofill_table_->MigrateToVersion37MergeAndCullOlderProfiles()) | 276 if (!autofill_table_->MigrateToVersion37MergeAndCullOlderProfiles()) |
| 277 return FailedMigrationTo(37); | 277 return FailedMigrationTo(37); |
| 278 | 278 |
| 279 ChangeVersion(&meta_table_, 37, true); | 279 ChangeVersion(&meta_table_, 37, true); |
| 280 // FALL THROUGH | 280 // FALL THROUGH |
| 281 | 281 |
| 282 case 37: |
| 283 if (!keyword_table_->MigrateToVersion38AddLastModifiedColumn()) |
| 284 return FailedMigrationTo(38); |
| 285 |
| 286 ChangeVersion(&meta_table_, 38, true); |
| 287 // FALL THROUGH |
| 288 |
| 282 // Add successive versions here. Each should set the version number and | 289 // Add successive versions here. Each should set the version number and |
| 283 // compatible version number as appropriate, then fall through to the next | 290 // compatible version number as appropriate, then fall through to the next |
| 284 // case. | 291 // case. |
| 285 | 292 |
| 286 case kCurrentVersionNumber: | 293 case kCurrentVersionNumber: |
| 287 // No migration needed. | 294 // No migration needed. |
| 288 return sql::INIT_OK; | 295 return sql::INIT_OK; |
| 289 } | 296 } |
| 290 } | 297 } |
| OLD | NEW |