PropertyMigration.h header
#include <ew/app/PropertyMigration.h>
Namespace ew::app
PropertyMigrationMove struct
struct ew::app::PropertyMigrationMove
One property the migration would move, and the single entity it would move to.
Members
ew::core::foundation::CategoryId ew::app::entity::PropertyMigrationMove::categoryId
The category that declares the property today.
QString ew::app::entity::PropertyMigrationMove::categoryName
That category's name, for the preview and the report.
QString ew::app::entity::PropertyMigrationMove::key
The property's storage key.
QString ew::app::entity::PropertyMigrationMove::label
The property's display label.
ew::core::foundation::ContentId ew::app::entity::PropertyMigrationMove::entityId
The one entity that holds a value for it.
QString ew::app::entity::PropertyMigrationMove::entityName
That entity's name.
PropertyMigrationPlan struct
struct ew::app::PropertyMigrationPlan
What the migration would do to a project: every property it would move, and how many it would leave alone.
Members
std::vector<PropertyMigrationMove> ew::app::entity::PropertyMigrationPlan::moves
The moves, in a stable order (by category name, then property label).
int ew::app::entity::PropertyMigrationPlan::kept = 0
How many declared properties the rule leaves on their category.
Functions
std::unique_ptr< ew::core::undo::Command > ew::app::entity::buildDeclinePropertyMigrationCommand(ew::core::project::Project &project)
A command that records a declined migration, so the prompt is not asked again.
std::unique_ptr< ew::core::undo::Command > ew::app::entity::buildPropertyMigrationCommand(ew::core::project::Project &project, const PropertyMigrationPlan &plan)
A command applying plan to project and recording the answer, as ONE undoable step.
No value is read, written or deleted: every move is the demote primitive, so a value that had a definition before still has one after – on its own entity instead of on a category. Null when the plan is empty.
bool ew::app::entity::needsPropertyMigration(const ew::core::project::Project &project)
Whether project should be offered the migration: it has never been asked, and there is something to move.
Both halves matter. A project that has answered is never asked again – a writer who declined is not nagged into an edit they refused. And a project the rule would not change is not asked at all, because a prompt offering to move nothing teaches writers to dismiss prompts.
PropertyMigrationPlan ew::app::entity::planPropertyMigration(const ew::core::project::Project &project)
What the migration would do to project, without changing anything.
The rule is a COUNT, not a proportion: for each property a category declares, count the entities beneath it holding a non-empty value. Zero keeps it (a schema nobody has filled in is still a schema). Exactly one demotes it – one holder is the signature of a property that was only ever about one thing. Two or more keeps it, because two entities holding their own values for the same property is the evidence that it IS shared, and sharedness does not scale with how many entities happen to sit in the category.
Deliberately conservative: it moves little. An automatic demotion of a genuinely shared property is the destructive mistake, and the promote/demote tools exist so the rest can be driven deliberately.
QString ew::app::entity::propertyMigrationReport(const PropertyMigrationPlan &plan)
plan as readable Markdown: every move named individually, and the count left alone.
Individually, not summarised: the rule is conservative enough that there will be few, and a list can be reviewed where "12 properties moved" can only be believed.