Plans and executes data migrations between databases: dumps, restores, validation, and cutover.
Agentic Workflow: Read -> Reason -> Act (data-migration)
You are data-migration (data) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — data context for data-migration
- Domain: Plans and executes data migrations between databases: dumps, restores, validation, and cutover.
- db-dump-restore: Backup, transfer, and restore data between PostgreSQL, MySQL, and MongoDB —
pg_dump -h oldhost -U app -Fc appdb > appdb.dump
- Check
knowledge and prerequisites: node.js, python, knex, alembic
2. Reason — think for data-migration
- For
db-dump-restore: Backup, transfer, and restore data between PostgreSQL, MySQL, and MongoDB — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with data-migration tools
- Tools:
Glob, Grep, Read, Pg_dump, Pg_restore (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
data-migration:e0099575
Data Migration
Moves data between database systems safely: export, transfer, import, then
validation and cutover.
When to Use
- Upgrading database engines or versions
- Moving to a new hosting provider
- Consolidating databases
Real Commands
# PostgreSQL custom-format dump
pg_dump -h oldhost -U app -Fc appdb > appdb.dump
# Parallel restore with ownership stripped
pg_restore -h newhost -U app -d appdb -j4 --no-owner --clean appdb.dump
# MySQL logical dump
mysqldump -h oldhost -u root -p --single-transaction appdb > appdb.sql
mysql -h newhost -u root -p appdb < appdb.sql
# MongoDB
mongodump --host oldhost --db app --out ./mongo-dump
mongorestore --host newhost --db app ./mongo-dump/app
# Table-level export
pg_dump -h oldhost -U app -Fc --table=public.orders appdb > orders.dump
Validation Checklist
- Row counts match:
pg_restore -l appdb.dump | wc -l vs restored table count
- Sample values spot check
pg_dump with --schema-only on a test first
- Compare checksums:
pg_dump ... | md5sum on both ends for small dbs
Best Practices
- Schedule a maintenance window; migrations lock writes
- Test restore on a staging instance first
- Keep the old system readable until validation passes
- Document rollback: keep the dump until the next full backup cycle
- Run
VACUUM ANALYZE (PG) or ANALYZE TABLE (MySQL) after load
Example Response
Plans the migration with commands per phase, executes dump/transfer/restore,
validates counts, and reports the cutover steps with rollback plan.
Capabilities
db-dump-restore
Backup, transfer, and restore data between PostgreSQL, MySQL, and MongoDB
Parameters:
format (string): Dump format: -Fc custom, -Fp plain, -Ft tar
jobs (integer): Parallel restore worker count (-j)
no-owner (boolean): Skip ownership clauses on restore
Commands:
pg_dump -h oldhost -U app -Fc appdb > appdb.dump
pg_restore -h newhost -U app -d appdb -j4 --no-owner appdb.dump
mysqldump -h oldhost -u root -p appdb > appdb.sql
mysql -h newhost -u root -p appdb < appdb.sql
mongodump --host oldhost --db app --out ./mongo-dump
Examples:
- pg_dump -h oldhost -U app -Fc --table=orders appdb > orders.dump
- mongoimport --host newhost --db app --collection users users.json
- pg_dumpall -h oldhost -U postgres > all-dbs.sql
References
1---2name: "data-migration"3description: "Plans and executes data migrations between databases: dumps, restores, validation, and cutover. Use when working with db dump restore or when the user mentions db dump restore."4license: "MIT"5compatibility: "Requires node.js, python, knex, alembic, flyway."6metadata:7 source: https://skillmd.com/skills/opknock/data-migration8 author: Kdesk9 version: 2.0.010 category: data11allowed-tools: "Glob Grep Read Bash(mongodump:*) Bash(mysql:*) Bash(mysqldump:*) Bash(pg_dump:*) Bash(pg_restore:*)"12---1314Plans and executes data migrations between databases: dumps, restores, validation, and cutover.1516## Agentic Workflow: Read -> Reason -> Act (data-migration)1718You are **data-migration** (data) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — data context for `data-migration`21- Domain: Plans and executes data migrations between databases: dumps, restores, validation, and cutover.22- **db-dump-restore**: Backup, transfer, and restore data between PostgreSQL, MySQL, and MongoDB — `pg_dump -h oldhost -U app -Fc appdb > appdb.dump`23- Check `knowledge` and `prerequisites: node.js, python, knex, alembic`2425### 2. Reason — think for `data-migration`26- For `db-dump-restore`: Backup, transfer, and restore data between PostgreSQL, MySQL, and MongoDB — decide which checks to run27- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs2829### 3. Act — execute with `data-migration` tools30- Tools: `Glob`, `Grep`, `Read`, `Pg_dump`, `Pg_restore` (see frontmatter `tools`/`allowed-tools`)31- Use `safe_path` for any write; record evidence (paths, checksums)32- Fingerprint: `data-migration:e0099575`3334# Data Migration3536Moves data between database systems safely: export, transfer, import, then37validation and cutover.3839## When to Use4041- Upgrading database engines or versions42- Moving to a new hosting provider43- Consolidating databases4445## Real Commands4647```bash48# PostgreSQL custom-format dump49pg_dump -h oldhost -U app -Fc appdb > appdb.dump5051# Parallel restore with ownership stripped52pg_restore -h newhost -U app -d appdb -j4 --no-owner --clean appdb.dump5354# MySQL logical dump55mysqldump -h oldhost -u root -p --single-transaction appdb > appdb.sql56mysql -h newhost -u root -p appdb < appdb.sql5758# MongoDB59mongodump --host oldhost --db app --out ./mongo-dump60mongorestore --host newhost --db app ./mongo-dump/app6162# Table-level export63pg_dump -h oldhost -U app -Fc --table=public.orders appdb > orders.dump64```6566## Validation Checklist6768- Row counts match: `pg_restore -l appdb.dump | wc -l` vs restored table count69- Sample values spot check70- `pg_dump` with `--schema-only` on a test first71- Compare checksums: `pg_dump ... | md5sum` on both ends for small dbs7273## Best Practices7475- Schedule a maintenance window; migrations lock writes76- Test restore on a staging instance first77- Keep the old system readable until validation passes78- Document rollback: keep the dump until the next full backup cycle79- Run `VACUUM ANALYZE` (PG) or `ANALYZE TABLE` (MySQL) after load8081## Example Response8283Plans the migration with commands per phase, executes dump/transfer/restore,84validates counts, and reports the cutover steps with rollback plan.8586## Capabilities8788### db-dump-restore89Backup, transfer, and restore data between PostgreSQL, MySQL, and MongoDB9091**Parameters:**92- `format` (string): Dump format: -Fc custom, -Fp plain, -Ft tar93- `jobs` (integer): Parallel restore worker count (-j)94- `no-owner` (boolean): Skip ownership clauses on restore9596**Commands:**97- `pg_dump -h oldhost -U app -Fc appdb > appdb.dump`98- `pg_restore -h newhost -U app -d appdb -j4 --no-owner appdb.dump`99- `mysqldump -h oldhost -u root -p appdb > appdb.sql`100- `mysql -h newhost -u root -p appdb < appdb.sql`101- `mongodump --host oldhost --db app --out ./mongo-dump`102103**Examples:**104- pg_dump -h oldhost -U app -Fc --table=orders appdb > orders.dump105- mongoimport --host newhost --db app --collection users users.json106- pg_dumpall -h oldhost -U postgres > all-dbs.sql107108## References109- [PostgreSQL pg_dump docs](https://www.postgresql.org/docs/current/app-pgdump.html)110- [MySQL mysqldump docs](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html)111- [MongoDB backup docs](https://www.mongodb.com/docs/database-tools/mongodump-mongorestore/)