MishkaCmsMigration. Resources. Changes. Decided
(Mishka CMS Migration v0.0.1)
Copy Markdown
View Source
Keeps an admin's decision on the conflict an item waits on
(MishkaCmsMigration.MigrationItem.conflict/1): the choice is put in the item's decisions
under that conflict and brings the item back, so every later dry run and import follows it;
"leave_out" leaves the item out instead.
The conflict is the one the action's conflict argument names, one of the item's open conflicts
(MishkaCmsMigration.MigrationItem.conflicts/1), such as "parent_missing" for Import anyway on
an item that waits for its parent, or the item's first (MishkaCmsMigration.MigrationItem.conflict/1)
when it names none; one that is not open on the item is as none.
Import anyway and Wait for its parent ("parent_missing") can be changed at any time, also once
an import wrote the item without its parent: neither moves the record the import wrote. Taken
back, the item waits for its parent again, and its record stays where the import wrote it until
the source changes the item; the next import that writes it again places it under its parent,
once the parent has a record.
Given as the action's decision argument, the choice of one item's Decide…, a choice the
conflict does not offer (MishkaCmsMigration.MigrationItem.choices/1), any choice on an item
that waits on none, and any choice on an item whose decision already took effect
(MishkaCmsMigration.MigrationItem.settled?/1), is refused on decision, in words an admin
reads; no choice changes nothing. A decision that took effect stays: an item an import wrote as
new is never moved onto the slug of the site's own record, which the Blog would refuse, and one
it connected to the site's record is never written over it.
update :choose do
argument :decision, :string
change MishkaCmsMigration.Resources.Changes.Decided
endGiven as :choice, the same answer for the rows an admin picked, it decides the items whose
conflict offers it and leaves the others as they are, so a bulk choice over mixed rows never
undoes the rows it answers.
update :decide_keep do
change {MishkaCmsMigration.Resources.Changes.Decided, choice: "keep"}
endWith bulk: true the decision and conflict arguments answer every item of the update at once,
atomically: the choice is merged into decisions under the conflict in the database, or
"leave_out" leaves them out, in one UPDATE for a group the Decisions panel decides. The action
narrows the items to those that wait for that decision, so every one of them is open on the
conflict; a choice the conflict does not offer is refused on decision.
update :decide do
argument :conflict, :string
argument :decision, :string
change filter(expr(waits_for_decision and waiting_conflict == ^arg(:conflict)))
change {MishkaCmsMigration.Resources.Changes.Decided, bulk: true}
end