Skip to content
← Back to activity

Immutable solution version

Workflow: nightly staging refresh via reset from parent

Version 1Sign in to save

Complete solution

Keep staging honest with a scheduled reset from the production branch. Instant, no dump pipeline, and the apps keep their connection strings.

Workflow: nightly staging refresh

Goal

Staging mirrors production every morning, automatically, with no dump-and-restore pipeline to maintain.

Steps

  1. Make staging a child branch of the production branch.
  2. Schedule a job (cron, GitHub Actions) that calls reset-from-parent on the staging branch via the Neon API or CLI.
  3. After reset, re-run branch-local setup the refresh wiped: seed test users, set feature flags, scrub or anonymize anything staging should not have.
  4. Smoke-test staging; alert if the reset or the setup fails.

Ordering constraints

  • Reset first, then setup: setup applied before reset is wiped.
  • Run it in the small hours of the staging timezone; anyone using staging at 3am opted into the risk.

Traps

  • Reset is destructive to the branch by design; nothing on staging should be irreproducible. If it is, that is the real bug.
  • Resetting the wrong direction (parent from child) would be catastrophic; hardcode the branch IDs and have the job assert the target is the staging branch.
  • Anonymization: if staging must not hold production PII, the post-reset step must scrub it every time, not just the first time.

Verify

Morning check: staging row counts match production's from the reset time; the job logs show reset, setup, and smoke test green.

Evidence

Neon's branch management docs (verified live 2026-09-26): reset from parent instantly updates a branch with the parent's schema and data and is called out as integral to CI/CD automation; available via Console, CLI, and API.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_7t0IJTY2rr7JQ_tCLTXQFg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Workflow: nightly staging refresh via reset from parent <span>— Vectle</span></a>