zanith

Recovery

Every destructive op (drop column, drop table) leaves an artifact — either a soft-drop tombstone or a real archive of the rows. zanith recover lists, inspects, restores, exports, and purges them.

Five artifact kinds

KindWhenStored
**softDropColumn**An op declared soft-drop for a column.Column stays in the table, marked dropped in the artifacts table.
**softDropTable**An op declared soft-drop for a table.Table renamed to _softdrop_, kept in the schema.
**archiveColumn**Column dropped with archive policy.Rows moved to a __archive_ table, then column dropped.
**archiveTable**Table dropped with archive policy.Table renamed to _archive_, schema kept.
**backfillCheckpoint**A long-running backfill checkpointed.Row in the checkpoints table — restart picks up where it left off.

The CLI surface

SHELL
zanith recover list # show every recoverable artifact
zanith recover inspect <name> # rows, size, recorded-at, source migration
zanith recover restore-column <name> # bring a soft-dropped or archived column back
zanith recover restore-table <name> # bring a soft-dropped or archived table back
zanith recover export <name> --format csv # stream rows out to stdout (csv / jsonl)
zanith recover purge <name> # permanently delete the artifact
zanith recover purge --older-than 30d # bulk purge by age

Restoring a column

SHELL
# A column was dropped two days ago — bring it back.
zanith recover list
# > orders_total_softdrop · 14 days ago · 412 MB · from 20260420_120000_drop_orders_total
 
zanith recover restore-column orders_total_softdrop
# > Re-attaches the column, restores the dropped index, marks the artifact restored.

Restore is idempotent — running it twice is a no-op the second time. The artifact stays in the recovery table marked restored until you purge it.

Exporting before purging

SHELL
# Take a CSV snapshot of an archive before purging.
zanith recover export old_orders_archive_2026_03 --format csv > old_orders_2026_03.csv
 
# Or JSONL for downstream pipelines.
zanith recover export old_orders_archive_2026_03 --format jsonl > old_orders.jsonl
 
# Then purge.
zanith recover purge old_orders_archive_2026_03

Retention policies

Each migration that creates an artifact can set retentionDays. purge --older-than sweeps anything past its retention window — a sensible cron entry on most production databases.

SHELL
# Daily housekeeping cron — purge anything past its retention window.
zanith recover purge --older-than 30d --json > /var/log/zanith/purges.jsonl

Programmatic API

The same operations are exposed as functions — see programmatic API for listArtifacts, findArtifact, restoreSoftDropColumn, restoreArchiveTable, readArtifactRows, purgeArtifact, purgeOlderThan.