schema-migration

Compare old and new DDL to identify data-loss risks in schema migrations.

792|138|Updated Feb 27, 2026
One-click install
npx skills add https://github.com/AltimateAI/altimate-code --skill schema-migration-altimateai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: schema-migration
Source: https://github.com/AltimateAI/altimate-code/tree/main/.opencode/skills/schema-migration
Command: npx skills add https://github.com/AltimateAI/altimate-code --skill schema-migration-altimateai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Analyze DDL migrations for data loss risks such as type narrowing, missing defaults, dropped constraints, and breaking column changes. Use before applying schema changes to production.

Core Features & Use Cases

  • Compare old vs new schemas to surface breaking changes and potential data loss in ALTER TABLE and CREATE TABLE migrations.
  • Diff YAML/JSON schemas and SQL models to detect column-level breaking changes and constraint changes.
  • Apply to dbt refactors and schema refactors to ensure downstream models remain valid.

Quick Start

Provide the old and new DDL or schema versions and run the analysis to surface data-loss risks before applying changes.

Frequently Asked Questions about schema-migration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect data-loss risks in SQL schema migrations?

Detect data-loss risks in SQL schema migrations by comparing old and new DDL to identify type narrowing, missing defaults, dropped constraints, and breaking column changes before applying them to production.

What schema changes can cause data loss in ALTER TABLE statements?

Schema changes that cause data loss in ALTER TABLE statements include irreversible type narrowing, adding NOT NULL columns without a DEFAULT, and dropping columns or constraints during the migration.

Can I check dbt model refactors for breaking schema changes?

Yes, you can check dbt model refactors for breaking schema changes by diffing old and new SQL models or YAML schemas to ensure downstream models remain valid and avoid column-level data loss.

Does this schema diff analysis support YAML and JSON schema files?

Yes, this schema diff analysis supports YAML and JSON schema files, comparing old and new versions to surface column-level breaking changes and constraint modifications across common SQL dialects.

What is the best way to prevent irreversible type changes before a production migration?

The best way to prevent irreversible type changes before a production migration is to run a schema diff analysis on old and new DDL to catch narrowing and invalid type conversions early.

When should I run a schema diff before applying database changes?

You should run a schema diff before applying database changes whenever you execute ALTER TABLE or CREATE TABLE migrations, refactor dbt models, or modify YAML schemas to prevent unexpected data loss.