Moves and deletes
Rename or move a document, and its branch follows. Delete one, and the documents below it move up a level.
Before
- Harbour/harbour
- Ferries/harbour/ferries
- Timetable/harbour/ferries/timetable
- Ferries/harbour/ferries
Harbour is published with the slug port
After
- Harbour/port
- Ferries/port/ferries
- Timetable/port/ferries/timetable
- Ferries/port/ferries
When a document is published with a new slug or parent, every document below it gets its new path, in its latest version too.
- A branch stays in its own collection, so a move rewrites only that collection.
- A move is never refused for its size. Speed has what a branch of 1,000 pages takes.
- Before anything is written, the plugin works out every new path in the branch, and refuses the move when one of them is taken or reserved.
- Saving a draft of a published document moves nothing until it is published. See Drafts.
Before
- Company/company
- Team/company/team
- People/company/team/people
- Team/company/team
An editor deletes Team
After
- Company/company
- People/company/peoplelifted
Deletes
Section titled “Deletes”Deleting a document lifts the documents right below it one level, to its parent or to the top level of its collection.
- The delete is refused, and nothing moves, when a lifted document would land on a taken path, a reserved slug or
/. - In a collection given with
parent: falsenothing sits below a document, so a delete lifts nothing. - With Payload’s
trash, nothing is lifted until the document is deleted for good. In the trash it takes no path, so another document may take it, and then taking it out of the trash is refused.
A move that stops halfway
Section titled “A move that stops halfway”With transactions, a failed move or delete leaves everything as it was. Without them, which is SQLite’s default, some documents keep their old paths until you run backfillPaths. Limits has what else a save during a move, or a database without transactions, can leave.