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 "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 "chrome/browser/diagnostics/sqlite_diagnostics.h" | 9 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" |
10 #include "chrome/browser/webdata/autofill_table.h" | 10 #include "chrome/browser/webdata/autofill_table.h" |
11 #include "chrome/browser/webdata/keyword_table.h" | 11 #include "chrome/browser/webdata/keyword_table.h" |
12 #include "chrome/browser/webdata/logins_table.h" | 12 #include "chrome/browser/webdata/logins_table.h" |
13 #include "chrome/browser/webdata/token_service_table.h" | 13 #include "chrome/browser/webdata/token_service_table.h" |
14 #include "chrome/browser/webdata/web_apps_table.h" | 14 #include "chrome/browser/webdata/web_apps_table.h" |
15 #include "chrome/browser/webdata/web_intents_table.h" | 15 #include "chrome/browser/webdata/web_intents_table.h" |
16 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
17 #include "sql/statement.h" | 17 #include "sql/statement.h" |
18 #include "sql/transaction.h" | 18 #include "sql/transaction.h" |
19 | 19 |
20 // Current version number. Note: when changing the current version number, | 20 // Current version number. Note: when changing the current version number, |
21 // corresponding changes must happen in the unit tests, and new migration test | 21 // corresponding changes must happen in the unit tests, and new migration test |
22 // added. See |WebDatabaseMigrationTest::kCurrentTestedVersionNumber|. | 22 // added. See |WebDatabaseMigrationTest::kCurrentTestedVersionNumber|. |
23 // static | 23 // static |
24 const int WebDatabase::kCurrentVersionNumber = 47; | 24 const int WebDatabase::kCurrentVersionNumber = 48; |
Joao da Silva
2012/12/13 10:12:26
Shouldn't this version match kCurrentDataVersion i
beaudoin
2012/12/13 17:14:53
I don't think so, I believe their closeness is coi
| |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 const int kCompatibleVersionNumber = 47; | 28 const int kCompatibleVersionNumber = 48; |
29 | 29 |
30 // Change the version number and possibly the compatibility version of | 30 // Change the version number and possibly the compatibility version of |
31 // |meta_table_|. | 31 // |meta_table_|. |
32 void ChangeVersion(sql::MetaTable* meta_table, | 32 void ChangeVersion(sql::MetaTable* meta_table, |
33 int version_num, | 33 int version_num, |
34 bool update_compatible_version_num) { | 34 bool update_compatible_version_num) { |
35 meta_table->SetVersionNumber(version_num); | 35 meta_table->SetVersionNumber(version_num); |
36 if (update_compatible_version_num) { | 36 if (update_compatible_version_num) { |
37 meta_table->SetCompatibleVersionNumber( | 37 meta_table->SetCompatibleVersionNumber( |
38 std::min(version_num, kCompatibleVersionNumber)); | 38 std::min(version_num, kCompatibleVersionNumber)); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
343 ChangeVersion(&meta_table_, 46, true); | 343 ChangeVersion(&meta_table_, 46, true); |
344 // FALL THROUGH | 344 // FALL THROUGH |
345 | 345 |
346 case 46: | 346 case 46: |
347 if (!keyword_table_->MigrateToVersion47AddAlternateURLsColumn()) | 347 if (!keyword_table_->MigrateToVersion47AddAlternateURLsColumn()) |
348 return FailedMigrationTo(47); | 348 return FailedMigrationTo(47); |
349 | 349 |
350 ChangeVersion(&meta_table_, 47, true); | 350 ChangeVersion(&meta_table_, 47, true); |
351 // FALL THROUGH | 351 // FALL THROUGH |
352 | 352 |
353 case 47: | |
354 if (!keyword_table_-> | |
355 MigrateToVersion48AddSearchTermsReplacementKeyColumn()) | |
356 return FailedMigrationTo(48); | |
357 | |
358 ChangeVersion(&meta_table_, 48, true); | |
359 // FALL THROUGH | |
360 | |
353 // Add successive versions here. Each should set the version number and | 361 // Add successive versions here. Each should set the version number and |
354 // compatible version number as appropriate, then fall through to the next | 362 // compatible version number as appropriate, then fall through to the next |
355 // case. | 363 // case. |
356 | 364 |
357 case kCurrentVersionNumber: | 365 case kCurrentVersionNumber: |
358 // No migration needed. | 366 // No migration needed. |
359 return sql::INIT_OK; | 367 return sql::INIT_OK; |
360 } | 368 } |
361 } | 369 } |
OLD | NEW |