mysql-migration-safety
Skill2 starsChanged 22 days agoMITView on GitHub
Design or review MySQL table, index, constraint, backfill and startup migrations; verify the actual version, application compatibility, locks, re-entrancy and failure recovery. Ordinary read-only queries do not start the migration procedure, and production SQL is never executed automatically.
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 13 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
Do: separate expansion (table/column), constraint or index, backfill, and contraction/drop.
- Distinctive: line 25
Stop condition: only an ordinary query -> do the matching query analysis only.
- Distinctive: line 28
Do: use Migration phases and recovery to write expand -> sync/backfill -> switch reads -> stop old writes -> contract.
- Distinctive: line 29
Stop condition: small changes without old/new coexistence may be simplified.
- Distinctive: line 32
Do: use DDL and locks to verify the algorithm, metadata lock and implicit commit for the actual version, engine and operation.
- Distinctive: line 33
Stop condition: target version not verified -> do not specify an algorithm.
- Distinctive: line 36
Do: with the migration plan template, give each step its entry criteria, DDL/data action, progress, abort threshold, failure state and …
- Distinctive: line 37
Stop condition: destructive change not approved -> stop at that step.
- Distinctive: line 40
Do: in an authorised local environment, run synthetic schema/data through normal, interrupt-and-re-enter, mixed old/new application, …
- Distinctive: line 41
Stop condition: no environment -> deliver a runnable design with the database-behaviour column marked unverified.
- Distinctive: line 44
Do: after a successful migration, verify the actual schema and constraints, backfill completeness and application readiness.
- Distinctive: line 45
Stop condition: failure -> keep the completed steps and the failure state.
- Distinctive: line 52
No verifiable recovery plan -> do not promise "can roll back" for irreversible actions.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
MySQL migration safety
Inputs:
- Actual MySQL version and storage engine;
go.mod, an image name or an old report cannot prove the current database version. - Old and new schema, including indexes and constraints.
- Reads and writes of the affected tables/columns by the old and new applications.
- Data size estimate and its source.
- Lock and downtime tolerance.
- Migration owner.
- Backup and restore capability.
- Permitted local synthetic environment.
Pick the route by change type
- Classify the change
- Do: separate expansion (table/column), constraint or index, backfill, and contraction/drop. Additive does not mean risk-free; widening also requires verifying charset, row size, algorithm and consumers.
- Stop condition: only an ordinary query -> do the matching query analysis only; do not enter the migration procedure.
- Artefact: list of change types and risk points.
- Design phases
- Do: use Migration phases and recovery to write expand -> sync/backfill -> switch reads -> stop old writes -> contract.
- Stop condition: small changes without old/new coexistence may be simplified; do not mechanically create every phase for each index.
- Artefact: phase sequence and old/new read-write matrix.
- Verify DDL and locks
- Do: use DDL and locks to verify the algorithm, metadata lock and implicit commit for the actual version, engine and operation. The MySQL 8.4 official facts in that file are only a version example.
- Stop condition: target version not verified -> do not specify an algorithm; list a pending-verification matrix only.
- Artefact: algorithm, lock and commit boundary for each DDL statement.
- Write the migration plan
- Do: with the migration plan template, give each step its entry criteria, DDL/data action, progress, abort threshold, failure state and recovery method. Reuse the existing migration tool and approval boundaries.
- Stop condition: destructive change not approved -> stop at that step; do not bypass permissions via "run automatic migration on startup".
- Artefact: completed migration plan.
- Local synthetic verification
- Do: in an authorised local environment, run synthetic schema/data through normal, interrupt-and-re-enter, mixed old/new application, NULL/duplicate, concurrency and time-boundary cases. Record only what was actually executed.
- Stop condition: no environment -> deliver a runnable design with the database-behaviour column marked unverified; do not substitute SQLite or reasoning from documentation for MySQL results.
- Artefact: actual run results or unverified items in the scenario table.
- Closing verification
- Do: after a successful migration, verify the actual schema and constraints, backfill completeness and application readiness.
- Stop condition: failure -> keep the completed steps and the failure state; stop false readiness that depends on the schema. Do not clear the dirty flag or force the version number so the service appears ready.
- Artefact: final-state evidence or failure-state record.
Missing inputs and outputs
- Actual version missing -> design phases and verification scenarios first; do not specify a supported DDL algorithm.
- Old application read/write information missing -> do not guarantee a rolling upgrade; list consumers pending verification.
- No verifiable recovery plan -> do not promise "can roll back" for irreversible actions.
Describe reversible schema, irreversible data and forward fixes separately.
Normal: adding a nullable column, first ensure existing writes maintain the new value, then backfill in batches and verify old and new reads agree; after old consumers retire, contract separately.
Counter-example: renaming the table in PostgreSQL's CREATE INDEX CONCURRENTLY and using it as a MySQL script, or assuming an outer transaction can undo all DDL.
For interrupt recovery, first verify whether the migration lock/executor is still present, the actual schema and the committed batches, then decide on re-entry; a client disconnect does not mean the database operation failed. Do not delete unknown progress or rerun non-re-entrant steps.
Mechanical schema-diff tidying may use low/low; phase design uses normal/medium; locks, constraints, concurrency, irreversibility and time/archive integrity use normal/high. Grade words map to actual execution configuration through the project resource mapping. Throughput and duration come from synthetic scale and actual resources; do not write estimates as real production measurements.
Closing cleanup: temporary databases, schemas, containers and backfill data used for rehearsal are cleaned up when the rehearsal ends; real databases are out of cleanup scope. Follow the local resource cleanup rules of task-implementation: register identities at creation, at closing clean up only the objects registered this time, write evidence to keep and cleanup failures into the receipt, and use no global cleanup commands.
Sources
- Pinned source: EC07 database-migrations; MySQL fact check in official 8.4 sections.
- Adopted only the expand/contract, batching and recovery organisation; the MySQL-specific content is own-authored for this package, no official manual text is copied, and Oracle material is not relabelled MIT. Dropped production data copies, PG syntax, universal rollback and automatic version forcing. Re-verify the relevant algorithms/limits on version upgrades or schema changes.
- License: shipped with the package as LICENSE-EC.txt (EC, MIT); library-wide third-party summary in the root THIRD_PARTY_NOTICES.md. Copy the license file along when copying this package alone.
In this repository39 other files it gives its agents.
- ai-trace-auditSkill
- ai-workspace-governanceSkill
- archive-maintenanceSkill
- change-reviewSkill
- cloud-api-integrationSkill
- coding-conventionsSkill
- container-image-managementSkill
- context-handoffSkill
- deployment-patternsSkill
- docker-local-environmentSkill
- documentation-authoringSkill
- estimationSkill
- external-dependency-simulationSkill
- gitlab-webhook-local-gitSkill
- go-patternsSkill
- go-testingSkill
- grpc-proto-contractSkill
- guided-evidence-collectionSkill
- http-api-designSkill
- jenkins-pipeline-jjbSkill
- ldap-rbacSkill
- plan-designSkill
- plan-reviewSkill
- playwright-e2eSkill
- project-contextSkill
- pytest-patternsSkill
- readonly-ops-diagnosticsSkill
- redis-patternsSkill
- release-readinessSkill
- role-bootstrapSkill
- security-reviewSkill
- skill-maintenanceSkill
- subtask-dispatchSkill
- systematic-diagnosisSkill
- task-implementationSkill
- test-strategySkill
- verification-gateSkill
- vue3-developmentSkill
- vue-testingSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

