{"success":true,"name":"change-live-systems-in-reversible-steps-migrations-and-deplo","description":"About to change the database or deploy to a live system in one leap","category":"ai-brimind","path":"ai-brimind/change-live-systems-in-reversible-steps-migrations-and-deplo/SKILL.md","file":"SKILL.md","content":"---\nname: change-live-systems-in-reversible-steps-migrations-and-deplo\ndescription: \"About to change the database or deploy to a live system in one leap\"\n---\n\n# Change Live Systems in Reversible Steps: Migrations and Deploys With a Way Back\n\n## When to use\nAbout to change the database or deploy to a live system in one leap\n\n## Example request\nRenamed a DB field and deployed → old records still carry the old field name and half the app reads nothing; the concept is expand-migrate-contract (add new, backfill, switch readers, only then remove old). Deploy done at peak hours straight to production → first bug hits every active user at once; the concept is deploy timing and small releases. Migration script run on live data with no backup → a bug in the script and the data's previous state no longer exists anywhere; the concept is backup-before-migration, always. Deploy 'succeeded' and everyone left → the app was actually down for 20 minutes; the concept is post-deploy verification (hit the health endpoint, run the key scenario).\n\n## Instructions\nAct as a surgeon of live systems: every operation on production gets a plan, an exit, and a post-op check — because live data has no undo button. Before ANY change to a running system (schema change, data migration, deploy, server config): (1) BACKUP FIRST — a restorable backup of the affected data taken immediately before, verified to exist, no exceptions; 'the script is simple' is what every lost-data story starts with; (2) REHEARSE — run the exact migration/deploy on a copy or local environment with realistic data first; the rehearsal is where scripts are allowed to have bugs; (3) CHANGE IN REVERSIBLE STEPS — for schema changes use expand-migrate-contract: ADD the new field/collection (old code unaffected), BACKFILL data, SWITCH the code to read the new shape, and only REMOVE the old after days of proven calm — never rename-and-pray in one shot; keep deploys small (one feature's worth), because small changes have small blast radii and obvious causes; (4) KNOW THE WAY BACK before you start — the rollback is written down: restore which backup, redeploy which previous version (Git tag/commit), revert which config — a rollback invented during an outage is panic, not procedure; (5) VERIFY AFTER — the change isn't done when the command exits: hit the health/main endpoints, run the one critical user scenario, watch the logs (PM2 logs on the [PRIVATE_HOST]) for the first minutes, and check one migrated record by eye; (6) STAMP IT — log the operation in the project's change log: what changed, when, by whom, where the backup is. If the system has real users, prefer low-traffic hours and tell the project owner before, not after. The difference between a professional operation and a gamble is one question answered in advance: 'and if it goes wrong, what exactly do we do?'\n\n## Metadata\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #179\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}