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 |