← ClaudeAtlas

migration_managementlisted

Author and apply fork-specific DB schema migrations — naming, format, how to apply locally and verify.
jedbjorn/subfloor · ★ 14 · API & Backend · score 76
Install: claude install-skill jedbjorn/subfloor
# migration_management — fork-specific schema changes Migrations live in `.super-coder/migrations/`, apply in numeric order, tracked by the `schema_migrations` ledger table. Engine updates apply pending migrations automatically; apply locally without a fetch via `sc update --no-fetch`. **Scope:** fork-specific changes — tables, columns, constraints, or system-content seeds (skills, flavor defaults) this fork needs that will not ship upstream. Upstream engine migrations arrive via `sc update`; no action from you. ## Authoring a migration 1. **Find the next number:** ```bash ls .super-coder/migrations/ | sort | tail -5 ``` Name the file `NNNN_<slug>.sql`, NNNN = next integer zero-padded to 4 digits (e.g. `0012`). 2. **Write the file** at `.super-coder/migrations/NNNN_<slug>.sql`: - Wrap in `BEGIN; ... COMMIT;` - Idempotent: `CREATE TABLE IF NOT EXISTS`, `INSERT OR IGNORE`, `CREATE INDEX IF NOT EXISTS`, `DROP TABLE IF EXISTS` before recreate - Comment header: migration number + intent (+ doctrine notes if relevant) - Structure + system content only — per-instance data (shell memory, grants, roadmap, flags) lives in `.sc-state/content.sql` via snapshot, never in migrations 3. **Apply locally:** ```bash sc update --no-fetch ``` Skips the upstream fetch; applies all pending local migrations in order. Confirm it landed: ```sql SELECT * FROM schema_migrations ORDER BY applied_at DESC LIMIT 5; ``` 4. **Verify:**