Chromium Code Reviews| Index: sync/syncable/directory_backing_store.cc |
| diff --git a/sync/syncable/directory_backing_store.cc b/sync/syncable/directory_backing_store.cc |
| index 417a4d10e3363a7630d1352ea9050f550f957e5f..1b8d36f18749e62fa9285ae392c2303adaacc8c9 100644 |
| --- a/sync/syncable/directory_backing_store.cc |
| +++ b/sync/syncable/directory_backing_store.cc |
| @@ -35,7 +35,7 @@ namespace syncable { |
| static const string::size_type kUpdateStatementBufferSize = 2048; |
| // Increment this version whenever updating DB tables. |
| -const int32 kCurrentDBVersion = 86; |
| +const int32 kCurrentDBVersion = 87; |
| // Iterate over the fields of |entry| and bind each to |statement| for |
| // updating. Returns the number of args bound. |
| @@ -406,6 +406,12 @@ bool DirectoryBackingStore::InitializeTables() { |
| version_on_disk = 86; |
| } |
| + // Version 87 migration adds datatype contexts to the models table. |
| + if (version_on_disk == 86) { |
| + if (MigrateVersion86To87()) |
| + version_on_disk = 87; |
| + } |
| + |
| // If one of the migrations requested it, drop columns that aren't current. |
| // It's only safe to do this after migrating all the way to the current |
| // version. |
| @@ -1266,6 +1272,15 @@ bool DirectoryBackingStore::MigrateVersion85To86() { |
| return true; |
| } |
| +bool DirectoryBackingStore::MigrateVersion86To87() { |
| + // Version 87 adds the datatype context to the models table. |
| + if (!db_->Execute("ALTER TABLE models ADD COLUMN context blob")) |
|
rlarocque
2014/04/03 01:08:06
Should I expect to see UPDATE and SELECT statement
Nicolas Zea
2014/04/03 21:01:11
I've gone ahead and added those to this CL.
|
| + return false; |
| + |
| + SetVersion(87); |
| + return true; |
| +} |
| + |
| bool DirectoryBackingStore::CreateTables() { |
| DVLOG(1) << "First run, creating tables"; |
| // Create two little tables share_version and share_info |