migrations

Provides guidance for customizing .NET's OnlineBanking module's Bank class.

14.8k|3.4k|Updated Jan 23, 2014
One-click install
npx skills add https://github.com/dotnet/efcore --skill migrations-dotnet
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrations
Source: https://github.com/dotnet/efcore/tree/main/.agents/skills/migrations
Command: npx skills add https://github.com/dotnet/efcore --skill migrations-dotnet

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides implementation details and extension points for EF Core migrations, enabling you to customize how migrations are generated, diffed, and applied across your projects.

Core Features & Use Cases

  • Guidance on customizing MigrationsSqlGenerator, model differencing, migration operations, and HistoryRepository integration.
  • Use cases include adapting migration scripts to project conventions, extending migration scaffolding, and validating migrations in tests.

Quick Start

Provide a target migration change and I will outline the necessary steps to implement it in MigrationsSqlGenerator, the model differ, and the Migrator.

Frequently Asked Questions about migrations

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

FAQPage Schema
How do I customize EF Core migration SQL generation for specific database conventions?

You customize EF Core migration SQL generation by extending MigrationsSqlGenerator to override how migration operations translate to SQL, allowing you to adapt generated scripts to match project-specific database conventions and syntax requirements.

What is model diffing in EF Core and how does it detect schema changes?

Model diffing in EF Core compares your current entity model against the previous snapshot to detect schema changes, generating migration operations that represent the differences needed to synchronize the database with your model.

How do I override the EF Core HistoryRepository to change migration tracking?

You override the EF Core HistoryRepository by creating a custom implementation that changes how applied migrations are recorded and queried, allowing you to control the table name, schema, or storage format for migration history data.

Can I extend EF Core migration scaffolding to automate custom migration steps?

Yes, you can extend EF Core migration scaffolding by customizing the Migrator and migration operations, allowing you to inject project-specific logic into the scaffolding process and generate migrations that follow your operational workflows.

How do I validate EF Core migrations in automated tests before deployment?

To validate EF Core migrations in tests, you apply migration operations against a test database and verify the generated SQL and model differencing results, ensuring migration scripts align with operational workflows before deployment.

What are the main integration points for customizing EF Core migrations?

The main integration points for customizing EF Core migrations include MigrationsSqlGenerator for SQL output, the model differ for change detection, migration operations for schema actions, HistoryRepository for tracking, and the Migrator for execution control.