[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EES4JDE9X2TFN1HM9ZPX2T":3,"skill-same:01M6EES4JDE9X2TFN1HM9ZPX2T":48},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":21,"linkOnly":22,"markdownContent":23,"markdownBody":23,"frontMatter":24,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":30,"ownerHtmlUrl":31,"ownerBlogUrl":6,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M6EES4JDE9X2TFN1HM9ZPX2T","data-migration",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fdata-migration\u002FSKILL.md",[],[18,19,20],"data","migration","data migration","2026-11-10 10:12:30",false,"# Data Migration\n\n## Overview\n\nBuilds automated data migration pipelines between databases. Handles schema analysis and mapping, type conversions, data transformations, dependency-ordered table loading, batch processing for large datasets, checkpoint\u002Fresume for reliability, post-migration validation, and cutover planning. Produces repeatable scripts that can be dry-run against staging before production.\n\n## Instructions\n\n### 1. Schema Analysis\n\nStart every migration by analyzing source and target:\n\n```\nFor each table in source:\n  - Column names, types, nullability, defaults\n  - Primary keys and auto-increment sequences\n  - Foreign key relationships (build dependency graph)\n  - Indexes and unique constraints\n  - Row count estimate (for batch sizing)\n  - Encoding\u002Fcollation (especially for MySQL → PostgreSQL)\n```\n\nGenerate a schema map document listing every column with its source type, target type, and any transformation needed.\n\n### 2. Type Mapping\n\nCommon cross-database type conversions:\n\n| MySQL | PostgreSQL | Notes |\n|-------|-----------|-------|\n| TINYINT(1) | BOOLEAN | Map 0\u002F1 to false\u002Ftrue |\n| ENUM('a','b') | VARCHAR + CHECK | Or create custom TYPE |\n| DATETIME | TIMESTAMPTZ | Add timezone info |\n| INT AUTO_INCREMENT | SERIAL | Reset sequence after migration |\n| DOUBLE | DOUBLE PRECISION | Direct mapping |\n| BLOB | BYTEA | Binary data |\n| TEXT (latin1) | TEXT (UTF-8) | Re-encode characters |\n| JSON | JSONB | Use binary JSON in PG |\n\n### 3. Dependency Resolution\n\nBuild a directed acyclic graph from foreign keys:\n\n```\n1. Parse all FK constraints → build adjacency list\n2. Topological sort → migration order\n3. Circular dependencies: temporarily drop FK, migrate, re-add FK\n4. Self-referencing tables: migrate in two passes (data, then self-FK updates)\n```\n\n### 4. Batch Processing\n\nFor tables with more than 10,000 rows:\n\n```\nfunction migrateLargeTable(table, batchSize = 5000):\n  lastId = loadCheckpoint(table) or 0\n  while true:\n    rows = SELECT * FROM source.table WHERE id > lastId ORDER BY id LIMIT batchSize\n    if rows.empty: break\n    transformed = rows.map(row => transform(row, table.mapping))\n    INSERT INTO target.table VALUES transformed\n    lastId = rows.last.id\n    saveCheckpoint(table, lastId, totalMigrated)\n```\n\nPerformance targets:\n- 5,000 rows\u002Fbatch for most tables\n- 1,000 rows\u002Fbatch for tables with BLOB\u002FTEXT columns\n- Disable target indexes during bulk load, rebuild after\n\n### 5. Validation\n\nPost-migration validation checklist:\n\n```\n1. Row counts: source vs target for every table\n2. Random sampling: 100 random rows per table, field-by-field comparison\n3. Aggregate checks: SUM, COUNT, MIN, MAX on numeric columns\n4. Referential integrity: all FKs resolve (no orphans)\n5. Encoding: sample text fields for valid UTF-8\n6. Sequences: verify auto-increment\u002Fserial values set above max ID\n7. Nullability: no unexpected NULLs in NOT NULL target columns\n```\n\n### 6. Cutover Planning\n\nThree strategies by downtime tolerance:\n\n**Full downtime** (simplest): Stop app → migrate → validate → start app. For small datasets (\u003C 1M rows, \u003C 1 hour).\n\n**Minimal downtime** (recommended): Pre-migrate bulk data → set up change capture → maintenance mode → apply delta → switch → validate. Downtime: 2-10 minutes.\n\n**Zero downtime** (complex): Dual-write to both databases → background migration → gradual read traffic shift → drop old writes. Requires application changes.\n\n## Examples\n\n### Example 1: MySQL to PostgreSQL\n\n**Prompt**: \"Migrate our MySQL 5.7 database to PostgreSQL 16. 30 tables, biggest is 5M rows.\"\n\n**Output**: Schema mapping JSON, type conversion DDL, migration script with dependency ordering, batch processing for large tables, checkpoint file, validation suite, and cutover runbook.\n\n### Example 2: Database Consolidation\n\n**Prompt**: \"Merge two SQLite databases into one PostgreSQL. Some tables overlap with different schemas.\"\n\n**Output**: Schema diff report, merge strategy document (which columns win conflicts), deduplication logic using configurable match keys, migration script, and conflict resolution log.\n\n## Guidelines\n\n- **Always dry-run on staging first** — never run migration directly against production\n- **Keep source untouched** — migration should be read-only on source until cutover\n- **Checkpoint everything** — large migrations will fail; resumability is required\n- **Validate before cutover** — automated validation catches what manual spot-checks miss\n- **Plan rollback** — if target validation fails, have a documented path back to source\n- **Log extensively** — rows processed, rows skipped, transformation errors, timing\n- **Reset sequences** — after migration, set serial\u002Fauto-increment above max migrated ID\n- **Test with production volume** — a script that works on 1000 rows may OOM on 5M\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FTerminalSkills\u002Fskills\u002Fdata-migration",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill data-migration",{"tool":40,"command":41},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill data-migration",{"tool":43,"command":44},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill data-migration","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fdata-migration\u002FSKILL.md",true,[],[49,58,67,76,82,88],{"skillNo":50,"name":51,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":21},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[55,56,57],"model","model hierarchy","model hierarchy skill",{"skillNo":59,"name":60,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":21},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[64,65,66],"MCP","zoom","zoom mcp",{"skillNo":68,"name":69,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":21},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[73,74,75,65],"sdk","zoom apps sdk","apps",{"skillNo":77,"name":78,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":21},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[78],{"skillNo":83,"name":84,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":21},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[84],{"skillNo":89,"name":90,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":21},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[90]]