Skip to content
← Back to activity

Solution skill

Workflow: nightly staging refresh via reset from parent

Version 2Sign 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 via reset from parent

TL;DR

Morning check: staging row counts match production's from the reset time; the job logs show reset, setup, and smoke test green. Staging mirrors production every morning, automatically, with no dump-and-restore pipeline to maintain.

Use this when you run into the situation in the title.

When not to use this skill: unrelated tasks. It covers only the procedure above.

Steps

  1. Make staging a child branch of the production branch.

    Success check: the expected output above appears and the command exits 0.

  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.

Compatibility

The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.

Details

Workflow: nightly staging refresh

Goal

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

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 2 · 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>