Skip to content

upgrade: take a validated backup before migrating the database #94

Closed

Description

@TusanHomichi

Existing issue check

  • I searched open and closed issues for this work.

Problem or outcome

Re-running the installer upgrades in place. The new executable applies forward-only migrations when it starts, and there is no downgrade: an older executable refuses a database it does not understand (ADR 0023). Nothing takes a backup at that moment. The recovery point for a bad upgrade is therefore whenever the last scheduled backup happened to run, which can be up to a day earlier.

Scope

In scope:

  • When serve starts and finds pending migrations, write a validated snapshot named for the pre-upgrade version before migrating. This uses the existing ADR 0006 path, and the off-server copy where one is configured. The snapshot is taken by the server, not the installer, so every upgrade path gets it.
  • Log the snapshot's name. Document recovery in docs/install.md: stop the service, install the older release, and restore that snapshot.

Out of scope:

  • An automatic rollback.
  • A downgrade path for the schema.

Acceptance criteria

  • Starting a binary with pending migrations writes and validates a snapshot before the first migration runs. Startup fails closed if the snapshot cannot be written.
  • No snapshot is written when nothing is pending.
  • The documented recovery steps are exercised once against two real release builds.

Expected proof

  • cargo test --workspace, with a test that applies a synthetic pending migration.
  • A recorded upgrade-and-restore run.

Execution record

  • Authority and source: filed by the integrator from the 2026-10-14 project survey, requested by the maintainer. Not yet selected for work.
  • Next action: maintainer prioritization.

Related roadmap, decisions, or issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions