name: database-migrator slug: database-migrator version: 1.0.1 displayName: "跨数据库迁移引擎兼容转换|简诗 AI" summary: "在不同数据库之间迁移模式、数据和逻辑:处理数据类型不兼容、SQL 方言差异、外键顺序、序列翻译和触发器重写。" description: "在不同数据库之间迁移模式、数据和逻辑:处理数据类型不兼容、SQL 方言差异、外键顺序、序列翻译和触发器重写。" tags: ["data-automation", "jianshi-ai"]
Move schemas, data, and logic between database providers. This is a cross-provider migration engine, not a schema designer: it handles data type incompatibilities, provider-specific SQL dialects, foreign key ordering, sequence and auto-increment translation, trigger rewrites, and stored procedure conversion. It validates with row counts and checksums and produces an auditable migration-plan.md.
Supported source/target pairs: PostgreSQL, MySQL, Supabase (Postgres), PlanetScale (MySQL), and MongoDB, in any direction.
更多技能请访问小葱技能站7w4.net。
Follow these steps precisely when this skill is invoked.
Gather migration parameters. Establish: source provider and version; target provider and version; connection method (live or dump file); schema scope (which schemas/tables); data migration (schema only or schema + data, full or partial); downtime tolerance; data volume; application dependencies; and output location (default to current directory). If the user already supplied these, skip the questions and proceed.
Discover the source schema. Extract tables, columns, types, defaults, constraints, indexes, foreign keys, triggers, procedures, functions, views, sequences, enums, and row counts. For MongoDB, scan collections to infer schema. For Supabase, also extract RLS policies, extensions, and publications. See references/schema-discovery.md.
Map data types. Translate every source type to the best target type and flag lossy or precision-changing conversions. Translate provider-specific SQL functions. See references/type-mapping.md.
Generate schema scripts. Resolve table creation order by topological sort (defer cyclic foreign keys). Generate DDL, translate sequences/auto-increment, rewrite triggers and stored procedures, and translate views. See references/script-generation.md.
Generate data migration scripts. Produce export, transform, and import commands for the source and target providers. See references/data-migration.md.
Generate the validation plan. Produce row count, checksum, foreign key integrity, index, trigger/procedure, and sample data spot-check queries for source and target. See references/validation.md.
Generate the rollback plan and downtime estimate. Produce reverse-order DROP scripts, backup/restore commands, application rollback steps, and a phased downtime estimate with reduction strategies. See references/rollback-and-downtime.md.
Generate migration-plan.md. Assemble the executive summary, scope, schema inventory, type mapping, incompatibilities, scripts, validation, rollback, downtime, risk assessment, checklists, step-by-step execution guide, and required application changes. Use the template in references/migration-plan-template.md.
Handle edge cases. Account for extremely large tables, lossy mappings, MongoDB document flattening, PlanetScale foreign key workarounds, Supabase specifics, and multi-schema migrations. Verify the plan against the quality checklist. See references/edge-cases.md.
获取使用帮助和更多实用 Skill,请关注公众号「简诗 AI」,或在 SkillHub 搜索「简诗 AI」这个数据库迁移工具质量不错,适合在不同数据库之间迁移数据使用。它把复杂的迁移工作拆成了清晰的步骤,类型转换规则比较全面,还考虑了各种可能出问题的边缘情况,计划模板也很详尽。主要不足是部分文档内容偏多,有些复杂;另外支持的数据库类型组合还不够完整,迁移到某些特定数据库时可能缺少详细指导。整体来说,这是一个实用且较为成熟的 Skill。