Simplify column shifting for removed properties a little

This commit is contained in:
Thomas Goyne 2015-09-04 14:24:11 -07:00 committed by Ari Lazier
parent 00d8bf4ef0
commit ba61ffde15
1 changed files with 3 additions and 4 deletions

View File

@ -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