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

Unified Diff: sync/syncable/directory_backing_store.cc

Issue 211523002: Add AttachmentMetadata to Sync's EntryKernel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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..5371f43b2a62e110b6681c91cf55f4d80b5adf53 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 a collection of attachment ids per sync entry.
+ 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,18 @@ bool DirectoryBackingStore::MigrateVersion85To86() {
return true;
}
+bool DirectoryBackingStore::MigrateVersion86To87() {
+ // Version 87 adds AttachmentMetadata proto.
+ if (!db_->Execute(
+ "ALTER TABLE metas ADD COLUMN "
+ "attachment_metadata BLOB")) {
+ return false;
+ }
+ SetVersion(87);
+ needs_column_refresh_ = true;
+ 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