Skip to content

Revisions and restoring

Articles

article_revisions holds a full snapshot of the state before an edit: article_id, title, summary, content, sections, references_json, status, a note of up to 200 characters, who made it and when.

A row means the article as it was before this change.

When a snapshot is taken

Moment Note
Any ordinary edit — PATCH /articles/{id}
An AI refine
Applying cross-references cross-references added
Restoring a revision before restoring #{id}
Adding or removing a figure
An illustration run

Restoring

Endpoint Does
GET /articles/{id}/revisions List them
GET /articles/{id}/revisions/{revision_id} Read one
POST /articles/{id}/revisions/{revision_id}/restore Put it back (moderator)

Restoring snapshots the current state first, then overwrites, then reindexes. So a mistaken restore has a way back, and the way back is another restore.

Questions

question_versions does the same job with a different shape: one JSON snapshot blob of the versioned fields, plus question_id, edited_by and created_at.

Written by PATCH /questions/{id} before any field changes.

Endpoint Does
GET /questions/detail/{question_id}/versions List, newest first
POST /questions/detail/{question_id}/versions/{version_id}/restore Put it back — and snapshot the current state first

What revisions do not capture

Links. Neither an article revision nor a question version records the question ↔ article links that existed at the time. Unlinking is therefore only partly reversible: re-linking restores the pair exactly, because the row holds no content, but nothing records that the link was ever there and there is no list of what was removed.

If the link came from an article topic claim, re-syncing the claim puts it back.

The bin

Articles and questions are soft-deleted: deleted_at is set, the row and its id survive, and anything pointing at it can be put back.

Articles Questions
Delete DELETE /articles/{id} DELETE /questions/{id}
List the bin GET /articles/trash GET /questions/trash
Restore POST /articles/{id}/restore PATCH /questions/{id}/restore
Purge for good DELETE /articles/trash/{id} DELETE /questions/{id}/permanent

An article that was never published is deleted outright, not binned. Nobody ever saw it, so there is nothing to restore it for.

There is no scheduled purge of articles or questions

The bin does not empty itself. Purging one is always an explicit, immediate, moderator-triggered delete. The only scheduled job in the system that destroys anything is purge_trashed_media, which handles binned images — see Figures and the bin.