본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)9.5k · #12248

convex-migrate-rehearse

하는 일

이 스킬은 운영 데이터에 손대기 전에, 실제 데이터의 복사본에서 위험한 데이터 변경을 테스트하게 합니다. 업데이트 중에 실제 사용자 데이터를 망가뜨리지 않으려는 소유자를 위한 스킬입니다.

사용하는 경우

  • ✓실시간 Convex 앱의 데이터 구조를 바꿔야 할 때.
  • ✓변경에 기존 레코드의 백필이 필요할 때.
  • ✓출시 전에 현실적인 데이터에서 변경이 작동한다는 증거를 원하는 경우.

스킬 링크

https://github.com/openclaw/clawhub/blob/main/.agents/skills/convex-migrate-rehearse/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/openclaw/clawhub/blob/main/.agents/skills/convex-migrate-rehearse/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“운영에 적용하기 전에 실제 데이터의 복사본에서 제 users 테이블 변경을 테스트해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 운영 스냅샷을 미리 보기 환경에 복사하고, 스키마 변경과 데이터 업데이트를 거기에 적용해 결과를 확인한 다음, 그제야 운영으로 승격합니다. 롤백을 위해 스냅샷을 보관합니다. 운영에는 여러분의 명시적인 승인이 필요합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

<!-- GENERATED from convex-agents content/capabilities/migrate-rehearse.json — do not edit by hand. -->

Rehearse a schema change on a preview before prod

A schema push on Convex validates every existing document against the new schema and FAILS the push if any row doesn't conform — a real data-conformance gate. The safe way to use that gate is to let it fail on a rehearsal copy, not on prod. This capability turns a preview deployment into that copy: seed it with a prod snapshot, push the new schema + run the backfill there, watch the gate, and only promote once it's green. It composes deploy-guard (target classification), migrate (the optional-then-tighten pattern), and @convex-dev/migrations (the batched, resumable backfill).

Workflow

  1. PRECONDITION: preview deployments need a Preview Deploy Key (dashboard → Project Settings → Deploy Keys → Preview) exported as CONVEX_DEPLOY_KEY before any --preview-create/--preview-name deploy — a plain npx convex login session cannot create previews, and this is a paid-tier feature. If no preview key is available, fall back to rehearsing on the personal dev deployment seeded with the snapshot, and say so.
  2. GUARD: deploy-guard — classify + announce the SOURCE (prod, being read) and the eventual TARGET (prod, being changed); get the fresh explicit yes for the prod promote up front and confirm the plan.
  3. SNAPSHOT the source data read-only: npx convex export --path snapshot.zip (from the deployment holding the real data; add --include-file-storage only if the migration touches files). This is a read; it changes nothing.
  4. CREATE the preview FROM THE PRE-CHANGE CODE — do this BEFORE editing schema.ts, so the preview starts on the schema the snapshot data already conforms to: npx convex deploy --preview-create migrate-<slug> (needs the preview key; auto-expires ~5 days). Seed it: npx convex import snapshot.zip --deployment migrate-<slug> (import targets a deployment by NAME with --deployment; there is no --preview-name flag on import). The import succeeds because the data still matches the old schema.
  5. REHEARSE on the preview, in the migrate order — each push is npx convex deploy --preview-name migrate-<slug> (re-deploys to the SAME preview, keeping its data; NOT convex dev, which targets personal dev): (a) make the new/changed field OPTIONAL and deploy — if existing rows violate it the push FAILS HERE on the copy with the offending shape; fix and re-push until green. (b) write a @convex-dev/migrations backfill and run it against the preview; verify every row is now valid. (c) tighten the validator (required / narrowed union) and deploy again — the gate now passes because the backfill ran.
  6. VERIFY on the preview: run the app's functions against the migrated data (MCP run/runOneoffQuery pointed at the preview, or a smoke query) to confirm behavior and shape.
  7. PROMOTE only on the fresh explicit yes from step 1: apply the SAME sequence to prod (optional schema → backfill → tighten). Because it already succeeded on prod-shaped data, the prod push repeats a proven run. Keep the snapshot as the rollback artifact (npx convex import snapshot.zip --replace --prod); state plainly that data written after the snapshot is lost, so keep the promote window short.
  8. CLEAN UP: the preview auto-expires; delete the local snapshot when done (it holds real data — treat it as sensitive, never commit it).

Rules

  • Create the preview from the PRE-CHANGE code and seed the snapshot BEFORE editing schema.ts — so the import conforms and the conformance gate then fails on the copy (not prod) when you push the change; each preview push is deploy --preview-name, import targets it with --deployment.
  • Follow the migrate order every time: optional field → push → backfill → verify → tighten → push; skipping 'optional first' makes the very first push reject existing rows.
  • The prod promote needs a fresh explicit yes (deploy-guard) and is a REPEAT of the proven preview run, not a new attempt.
  • Keep the prod snapshot as the rollback artifact; state plainly that a snapshot-restore loses data written after the snapshot, so keep the promote window short.
  • Treat the exported snapshot as sensitive real data: delete it locally when finished; never commit it.
  • Backfills go through @convex-dev/migrations (batched, resumable, dry-runnable), not ad-hoc one-shot mutations over a whole table.
  • This is the rehearsal-and-promote flow; for the plain 'explain optional-then-t
자주 묻는 질문

미리 보기 환경을 쓸 수 없다면요?

스킬은 스냅샷을 채운 개인 개발 배포로 대체하며, 그렇다고 알려 줍니다.

운영 환경은 승인 없이 바뀌나요?

아닙니다. 어떤 변경이든 운영으로 승격하기 전에 새로운 명시적 승인을 요청합니다.

스냅샷은 무엇을 위한 것인가요?

승격된 변경을 되돌려야 할 경우를 대비한 롤백 옵션으로 보관됩니다.

상세 정보

작성자의 원본 설명

Rehearse a live-app schema change + backfill on a snapshot-seeded preview deployment, verify, then promote the proven change to prod with the snapshot as rollback.

repo: openclaw/clawhub

인기도

GitHub 스타
9.5k
순위
#12248
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬