Protect a database
A backup you have never restored is a backup you cannot trust, and a database deleted by mistake takes its data with it. The protection settings guard against both: they block accidental deletion, take a restore point before destructive SQL, and test your backups every week.
| Setting | CLI flag | What it does | Needs backup storage |
|---|---|---|---|
| Deletion protection | --deletion | Orchard refuses to delete the database until you turn this off. | No |
| Checkpoint before drops | --ddl-checkpoints | Orchard takes a restore point before any DROP TABLE, DROP SCHEMA, or DROP COLUMN runs. | Yes |
| Weekly restore tests | --restore-tests | Orchard restores the latest backup into a temporary copy each week and checks the result. | Yes |
Prerequisites
Section titled “Prerequisites”- Edit access to the project: the Admin or Member project role.
- A dedicated database.
- For Checkpoint before drops and Weekly restore tests, backup storage for the organization or the instance.
Change the protection settings
Section titled “Change the protection settings”- Open the database.
- Go to Settings > Protection.
- Turn each setting on or off. Orchard saves each change immediately.
Each flag accepts on or off:
orchard db protect <dbId> --deletion on --ddl-checkpoints on --restore-tests onDelete a protected database
Section titled “Delete a protected database”If you try to delete a protected database, Orchard returns this error:
<name> has deletion protection on. Turn it off in its settings first.To delete the database, turn off Deletion protection first.
After you turn these on, you can recover from a dropped table with a checkpoint, and a failed weekly test sends a notification.
Related resources
Section titled “Related resources”- Back up and restore a database - Restore from a checkpoint, a backup, or a point in time.
orchard db protectreference - Review the protection flags.