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.
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.
更多技能請訪問小蔥技能站7w4.net。
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。