Rustango docs

Soft-delete and restore rows

Problem

Deleting a record should be reversible and keep audit history.

Mark the model #[rustango(soft_delete)]. Deletes set a timestamp instead of removing the row; the default manager hides trashed rows automatically.

post.soft_delete(&pool).await?;          // hidden from Post::objects()
post.restore(&pool).await?;              // back in the active set
let trashed = Post::objects().trashed().fetch(&pool).await?;
Post::objects().purge_older_than(days(30), &pool).await?;  // hard-delete old