Simplify column shifting for removed properties a little
This commit is contained in:
parent
df6d6e8618
commit
1fcc5a1be8
|
@ -233,16 +233,15 @@ bool ObjectStore::create_tables(Group *group, Schema &target_schema, bool update
|
||||||
// remove extra columns
|
// remove extra columns
|
||||||
size_t deleted = 0;
|
size_t deleted = 0;
|
||||||
for (auto& current_prop : current_schema.properties) {
|
for (auto& current_prop : current_schema.properties) {
|
||||||
|
current_prop.table_column -= deleted;
|
||||||
|
|
||||||
auto target_prop = target_object_schema->property_for_name(current_prop.name);
|
auto target_prop = target_object_schema->property_for_name(current_prop.name);
|
||||||
if (!target_prop || property_has_changed(current_prop, *target_prop)) {
|
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;
|
++deleted;
|
||||||
current_prop.table_column = npos;
|
current_prop.table_column = npos;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
current_prop.table_column -= deleted;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// add missing columns
|
// add missing columns
|
||||||
|
|
Loading…
Reference in New Issue