From b7936bb0476a3a993f5477aea5577739a95fa26b Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 4 Sep 2015 14:24:11 -0700 Subject: [PATCH] Simplify column shifting for removed properties a little --- object_store.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/object_store.cpp b/object_store.cpp index 38ed3d4b..035ce4fc 100644 --- a/object_store.cpp +++ b/object_store.cpp @@ -233,16 +233,15 @@ bool ObjectStore::create_tables(Group *group, Schema &target_schema, bool update // remove extra columns size_t deleted = 0; for (auto& current_prop : current_schema.properties) { + current_prop.table_column -= deleted; + auto target_prop = target_object_schema->property_for_name(current_prop.name); if (!target_prop || property_has_changed(current_prop, *target_prop)) { - table->remove_column(current_prop.table_column - deleted); + table->remove_column(current_prop.table_column); ++deleted; current_prop.table_column = npos; changed = true; } - else { - current_prop.table_column -= deleted; - } } // add missing columns