add-migration
/add-migration
Dodaje lub zmienia migrację schematu Postgres: nową tabelę, kolumnę albo indeks, i uruchamia polecenie migracji w projekcie.
- Autor
- KyRocks19 ↗
- Repozytorium
- divination-station-takeoff ↗
- Licencja
- AGPL-3.0
- Ostatnia zmiana repozytorium
- 02.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 02.11.2026, bez odwołań do wycofanych modeli i API.
AGPL-3.0, copyleft: przeróbki udostępniane innym muszą mieć tę samą licencję.
Co robi i kiedy
Dodaje lub zmienia migrację schematu Postgres: nową tabelę, kolumnę albo indeks, i uruchamia polecenie migracji w projekcie.
Oryginalny opis (EN)
Add or change a Postgres schema migration. Use when a feature needs a new table, column or index, or when running `npm run migrate`.
Jak działa
- Rules
- Running (live Neon DB, confirm first)
- After writing it
- Dev branch first (added 2026-10-15)
Podgląd SKILL.md
--- name: add-migration description: Add or change a Postgres schema migration. Use when a feature needs a new table, column or index, or when running `npm run migrate`. --- # Adding a migration Migrations live in `migrations/NNN_name.sql` (next number = highest + 1; `002` is intentionally absent). `scripts/migrate.ts` auto-discovers every `NNN_*.sql`, sorts them, and records applied files in the `schema_migrations` table. No manual registration is needed. ## Rules 1. **Must be idempotent**: `CREATE TABLE IF NOT EXISTS`, `ADD COLUMN IF NOT EXISTS`, `CREATE INDEX IF NOT EXISTS`, `ON CONFLICT DO NOTHING`, or a `DO $$ ... IF NOT EXISTS ... $$` block (see `011_reversed_concepts.sql`). Databases that predate `schema_migrations` re-run old files once. 2. Postgres dialect only. Existing boolean-ish columns use integers (`is_admin`, `is_preset` = 0/1); match the neighboring table's convention. 3. Add a one-line comment at the top describing the change. 4. Never edit an already-applied migration; add a new one. 5. Update TypeScript types and queries that touch the changed tables. 6. **Say whether older versions can still use the data**, in a line of its own: `-- older-versions: ok` (only a new table, or a new column with a default that older code never reads) or `-- older-versions: no` (anything older code could misread). Unmarked counts as `no`, and `tests/local-db.test.ts` fails on an unmarked file after 099. An `ok` migration must not rely on a one-time data step for rows written later; put that in start-up code (`lib/local-seed.ts`). Why: an older downloaded copy opens newer data only when every newer change said `ok` (`docs/setup-guide.md`, "Updating a copy"). ## Running (live Neon DB, confirm first) `npm run migrate` loads `.env.local` and writes to the **live** database. Before running: show the user the SQL and the list of pending files, and get an explicit OK. After: confirm the output shows `✓ Applied` for the new file only (others `- Skipped`). ## After writing it 1. Run it on the dev branch (next section) and click through the change (`test-as-user`). 2. Run `data-lifecycle-check`: owner scoping, deletion, the Settings export, search, the companion, the privacy notice. Nothing fails loudly when one of these is missed. 3. Before any push or deploy, run `live-migration-check`: it lists what live is missing, which code breaks without it, and the order of steps for the user. Code that reads a new column needs the migration on live **first**, or a guard like the tiers in `lib/prefs.ts`. 4. Record the number as owed in `docs/open-items.md` (section B or D); `open-item-sync` keeps that line true. ## Dev branch first (added 2026-10-15) Run every new migration on the Neon **dev branch** before live. `npm run migrate` reads `.env.local` (live), so point it at dev explicitly: ```bash export DATABASE_URL="$(grep -E '^DATABASE_URL=' .env.development.local | cut -d= -f2- | tr -d '\r"')" echo "$DATABASE_URL" | sed -E 's#.*@([^/:?]+).*#\1#' # print ONLY the host, then check it ``` Dev host starts `ep-your-dev-branch`; live starts `ep-your-live-db`. Make migrations idempotent, never rename or drop. The live database is migrated by the user, who is owed the earlier ones (see PROGRESS.md).
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · KyRocks19/divination-station-takeoff | 100 | AGPL-3.0 |
| artk0de/tearags-mcp | 100 | MIT |
| kadirguloglu/kg-devkit | 96 | MIT |
| kadirguloglu/kg-devkit | 96 | MIT |
Migawka bazy z 13.11.2026 · wersja paczki 6407d3d551b2 (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
- 100add-store-query
Dodaje lub zmienia zapytanie SQL do magazynu SQLite: metodę odczytu i zapisu w pkg/store, nową kolumnę, indeks lub migrację schematu z synchronizacją wyzwalaczy FTS5. - 95database-migration
Tworzy migrację bazy danych ze zmianami schematu i wycofaniem, gdy trzeba dodać tabelę albo zmodyfikować schemat. - 96postgres-safe-migration
Pisze bezpieczne migracje PostgreSQL dla tabel z danymi, zmian kolumn, indeksów i ograniczeń. - 87postgres-migration
Zmienia schemat Postgresa bez psucia poprzedniego wydania: wzorzec expand i contract dla kolumn, tabel, typów i indeksów. - 100db-migration
Pomaga przygotować zmianę schematu lub danych PostgreSQL przez Liquibase albo Flyway: nowa tabela, kolumna, indeks, ograniczenie, backfill i migracja bez przestojów. - 100migration-helper
Pisze bezpieczne migracje schematu i danych z planem wycofania i sprawdzeniem blokad dla Postgres i MySQL.