15 lines
1.1 KiB
Markdown
15 lines
1.1 KiB
Markdown
# Tip #31 — Soft-Delete with 30-day restore
|
|
|
|
**Date:** 2026-07-12
|
|
**Category:** admin
|
|
**Source:** MC-Survival Wiki Daily Tip (backfilled from state.json)
|
|
## Soft-Delete with 30-day restore
|
|
|
|
Soft-delete adds a deletedAt: DateTime? column to Recipe and Tab models, hides soft-deleted rows from default queries, and exposes a 'Restore' action in the admin UI for 30 days before a cron hard-deletes them. It solves the irreversible-mistake problem: an admin clicks the wrong row, a moderator removes a popular recipe, and there is no undo. Player behavior reinforces this — a wiki that loses data on delete drives editors to be timid, which is the opposite of what a growing wiki needs. The 30-day window is industry-standard (Notion, Linear, GitHub all use similar windows) and is short enough that storage cost stays trivial.
|
|
|
|
## Implementation tips
|
|
|
|
1. Add deletedAt: DateTime? to Recipe and Tab models. Default queries filter deletedAt: null.
|
|
2. Add a cron (or admin button) that hard-deletes records older than 30 days.
|
|
3. Admin list view shows deleted items faded, with a 'Restore' button — single Prisma update.
|