diff --git a/scripts/datastorage_orphans.py b/scripts/datastorage_orphans.py index 72148e94..46ce382b 100644 --- a/scripts/datastorage_orphans.py +++ b/scripts/datastorage_orphans.py @@ -30,6 +30,9 @@ def clone_device(device): new_device.devicehub_id = old_devicehub_id device.devicehub_id = None new_device.owner = device.owner + if device.parent and device.parent.binding: + new_device.parent = device.parent.binding.device + db.session.add(new_device) placeholder = Placeholder(