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

Unified Diff: sync/syncable/directory_backing_store.cc

Issue 395913003: Add server_attachment_metadata field to EntryKernel and sync database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
« no previous file with comments | « sync/syncable/directory_backing_store.h ('k') | sync/syncable/directory_backing_store_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/syncable/directory_backing_store.cc
diff --git a/sync/syncable/directory_backing_store.cc b/sync/syncable/directory_backing_store.cc
index 55a01e6c352830ee0f9d345c02c1f3c05b40f828..6d08b75c1bebe271c0da86ee2c5a1b7b0e490246 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 = 88;
+const int32 kCurrentDBVersion = 89;
// Iterate over the fields of |entry| and bind each to |statement| for
// updating. Returns the number of args bound.
@@ -443,6 +443,12 @@ bool DirectoryBackingStore::InitializeTables() {
version_on_disk = 88;
}
+ // Version 89 migration adds server attachment metadata to the metas table.
+ if (version_on_disk == 88) {
+ if (MigrateVersion88To89())
+ version_on_disk = 89;
+ }
+
// 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.
@@ -1326,6 +1332,18 @@ bool DirectoryBackingStore::MigrateVersion87To88() {
return true;
}
+bool DirectoryBackingStore::MigrateVersion88To89() {
+ // Version 89 adds server_attachment_metadata.
+ if (!db_->Execute(
+ "ALTER TABLE metas ADD COLUMN "
+ "server_attachment_metadata BLOB")) {
+ return false;
+ }
+ SetVersion(89);
+ needs_column_refresh_ = true;
+ return true;
+}
+
bool DirectoryBackingStore::CreateTables() {
DVLOG(1) << "First run, creating tables";
// Create two little tables share_version and share_info
« no previous file with comments | « sync/syncable/directory_backing_store.h ('k') | sync/syncable/directory_backing_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698