About draft pages handling in Collaborative Editing

We have a job as part of a custom add-on that moves pages from one space to another.
We are using transaction and pageManager.movePageAsChild(currentPage, newParentPageInOtherSpace).
We`ve noticed however page is moved to another space, in old space some kind of a “draft” page persists.
We are using this SQL to fing that “drafts”
select *
from CONTENT c
where c.spaceid=487096324
and c.content_status=‘draft’ and c.prevver in (
select contentid from CONTENT
where c.prevver=contentid and spaceid!=c.spaceid
);
Where c.spaceid=487096324 is id of old space.
We suppose this draft is connected with Collaborative Editing feature and temp data is stored there until page is published.
We are asking because we have an issue while deleting old space, it fails until these “drafts” are removed from db.
Please give us an advice what should we do to move pages the right way.
Because deleting content from db directly is not the right way to solve this.

1 Like

Any update on this??