Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Unified Diff: sync/syncable/directory_backing_store.cc

Issue 218623014: [Sync] Add context proto and directory support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update protos Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698