Files
DiceCloud/app/imports/migrations/archive/properties/migrateProperty2To3.js
2024-10-31 11:34:14 +02:00

12 lines
337 B
JavaScript

export default function migrateProperty2To3(prop) {
prop.root = prop.ancestors[0];
if (!prop.root) {
throw new Error('Property has no root ancestor, will become orphaned')
}
if (prop.parent?.collection === 'creatureProperties') {
prop.parentId = prop.parent.id;
}
prop.left = prop.order;
prop.right = prop.order;
}