change-data-safely
/change-data-safely
Zmienia schemat bazy lub zapisane dane bez psucia działającego kodu i bez utraty danych, przy migracjach i usuwaniu.
- Autor
- yaohuangguan ↗
- Repozytorium
- agent-playbook ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 07.11.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 07.11.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Zmienia schemat bazy lub zapisane dane bez psucia działającego kodu i bez utraty danych, przy migracjach i usuwaniu.
Oryginalny opis (EN)
Change a database schema or stored data without breaking running code or losing data. Use this for any migration, new or changed column, backfill, bulk update, delete, index, or change to a stored format, including in small projects. Data mistakes are often impossible to undo.
Jak działa
- When to use
- Steps
- Stop and ask when
- Common mistakes
- Report
Podgląd SKILL.md
--- name: change-data-safely description: Change a database schema or stored data without breaking running code or losing data. Use this for any migration, new or changed column, backfill, bulk update, delete, index, or change to a stored format, including in small projects. Data mistakes are often impossible to undo. --- # Change data safely Code can be rolled back, but lost data often cannot. During a deploy, old and new code run against the same data at the same time, so each step must work for both. ## When to use Any change to stored data or its shape. ## Steps 1. **Read the current state.** Read the schema and existing migrations. Find every reader and writer of the affected data. 2. **Ask what already exists.** Think about rows with nulls, duplicates, old formats and very large tables. Test against these, not only fresh data. 3. **Split risky changes into stages.** | Stage | Action | Safe because | | --- | --- | --- | | Expand | Add the new column or table, nullable | Old code ignores it | | Write both | New code writes old and new | Either version can read | | Backfill | Copy old rows in small batches | Can stop and resume | | Read new | Switch reads to the new field | Old data is still there | | Contract | Remove the old field, in a later release | Nothing uses it now | Renaming a column in place breaks whichever code version is not expecting it. 4. **Make each step safe to rerun.** A migration or backfill can stop halfway. Running it twice must not corrupt data. 5. **Consider locks and size.** Adding an index or rewriting a large table can block production. Use the database's online option, and process rows in batches. 6. **Test it.** Run the migration on a copy of the schema with realistic old rows. Run all migrations from empty too. Confirm that row counts and values are right. 7. **Plan recovery.** Write down how to undo each step. If a step cannot be undone, say so. Confirm that a recent backup exists and can be restored. 8. **Get approval before production.** Show the exact statements, the affected row count and the recovery plan. Do not run them against production without explicit approval for that specific action. 9. **Check the result.** Compare counts and sample rows. Then follow `verify-and-report`. ## Stop and ask when - The change deletes or overwrites data, or removes a column or table. - You are unsure which environment a connection points to. - There is no tested backup. ## Common mistakes | Tempting move | Why it fails | Do this instead | | --- | --- | --- | | Rename a column in one step | Breaks old or new code | Expand, migrate, contract | | Add `NOT NULL` with no default | Fails on existing rows | Add nullable, backfill, then constrain | | `UPDATE` or `DELETE` without a preview | Can hit every row | Run a `SELECT` with the same filter first | | Update one huge batch | Locks the table | Use small batches | | Test only on an empty database | Misses real data | Include old-format rows | | Edit a migration that already ran | Environments drift apart | Add a new migration | ## Report ```markdown Change: <schema or data change> Affected: <tables and row counts> Compatibility: <how old and new code both work during deploy> Tested on: <data used, and the result> Recovery: <how to undo, or why it cannot be undone> Production: <not run / run with approval, and the result> ```
Wersje
W bazie nie ma innych skilli o nazwie change-data-safely.
Migawka bazy z 13.11.2026 · wersja paczki e95b2bb46698 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100safe-migration
Pisze lub przegląda migrację bazy danych, która wdraża się bez blokowania tabel, bez psucia działającego kodu i bez utraty danych. - 90add-db-migration
Wprowadza zmiany schematu bazy danych: nowe tabele i kolumny, indeksy, ograniczenia i uzupełnianie danych, z ostrożnością wymaganą przy ryzykownych migracjach. - 100backend-migration-writer
Pisze bezpieczną, odwracalną migrację bazy danych: pliki up i down, plan uzupełnienia danych, analiza budżetu blokad i strategia wycofania. - 100alembic-migration
Tworzy, sprawdza i stosuje zmiany schematu bazy przez Alembic, gdy zmienia się model SQLAlchemy, kolumna, indeks, ograniczenie lub potrzebny jest backfill danych. - 90prisma-migration
Bezpiecznie zmienia schemat bazy Order Hub w prisma/schema.prisma i tworzy migrację Prisma dla nowych modeli, pól, indeksów i relacji. - 100reversible-migration
Przenosi schemat, dane lub API ze starej wersji do nowej bez utraty danych: rozszerza, migruje, weryfikuje i zwęża, z drogą wycofania.