# Version history: see, undo and restore changes
Source: https://sovaria.in/docs/version-history

Every change to policies, tables, functions, settings, buckets and keys is recorded on a timeline. See what a change did, undo just that change, or take the project back to an earlier point.

Sovaria records your project's configuration on a timeline, like commits in git. A commit is written automatically whenever a policy, table, function, project setting, bucket or API key changes — from the console, the CLI, the SDKs or Sovariq. Your app's data rows are not part of the timeline; they are covered by backups.

(Diagram: Every change becomes a commit you can undo)

## What a change did

In **Version History**, pick a commit. Each item it touched is listed in words — "column note added (text)", "allowPublicSignup: false → true", "rule changed" — next to that item's own previous version, not simply the previous commit (which is usually about something else). Expand an item to see before and after.

## Undo one change

**Undo this change** puts back exactly what that commit changed and nothing else. You see the plan first: the items that go back, items that changed again since (undoing puts back the older version of those too), and who would gain or lose access afterwards. A schema change is undone by running its migration's down SQL; if a migration has no down SQL, the undo is blocked and says which one.

## Go back to an earlier point

To return the whole project configuration to a moment in time, show the restore plan, then apply it. Changes are made through the normal API with your own permissions, so policies and plan limits still apply and the restore itself becomes a new commit.

CLI:
```bash
# What the project looked like then (policies/, schema/, functions/, settings/, storage/, keys/)
sov chrono state --at 2026-10-15T09:00:00Z --prefix policies/ --names-only

# Show the plan, confirm, apply
sov chrono restore 2026-10-15T09:00:00Z
```

JavaScript:
```ts
const plan = await sovaria.chrono.restorePlan('2026-10-15T09:00:00Z')
// review plan.actions and plan.preview.violations, then (schema and database are opt-in):
await sovaria.chrono.restore('2026-10-15T09:00:00Z', 'main', { includeSchema: false, includeDatabase: false })
```

Python:
```python
plan = await sovaria.chrono_restore_plan("2026-10-15T09:00:00Z")
await sovaria.chrono_restore("2026-10-15T09:00:00Z")
```

## Branches

`main` is production's history. Every environment (staging, an API version, a pull request preview) has its own branch that records the changes made in it, so reverting staging never touches production and the other way round. A branch you create is a workspace copy of the whole project with its own database and history; deploy it into production or staging when it's ready. Checking out, deploying and snapshots are in [Branches and previews](https://sovaria.in/docs/branches-and-previews).

A revert acts only on its branch's environment. Rolling back migrations and restoring the database are separate boxes you tick; nothing else in the database changes. The dialog waits until the revert's own commits are recorded and shows the new head.

CLI:
```bash
sov branches revert 2026-10-15T09:00:00Z                 # production (main)
sov branches revert 3f2a9c1e --branch staging --include-schema
sov chrono timeline-list
```

> **Snapshots:** A snapshot names a point on a branch, and can also keep a checkpoint of its database. Restore it in one step from the Snapshots tab (plan first, database optional); see [Branches and previews](https://sovaria.in/docs/branches-and-previews#snapshots).

## Production notes

- Restores and undos run with your permissions: a developer can't restore a change they couldn't make by hand.
- Secrets are never stored on the timeline — only that a key or secret exists, not its value.
- Recovering database **data** uses daily backups or, on Pro and higher, point-in-time recovery to any second; see [Backups and recovery](https://sovaria.in/docs/backups-and-recovery).
