What problem does it solve?
Writing OrchardCore data migrations requires following a strict version-chain convention (CreateAsync plus sequential UpdateFromXAsync methods), and mistakes like renumbering shipped methods or omitting column lengths break tenant upgrades across database providers. This Skill guides you through the correct patterns so migrations run reliably on fresh installs and upgrades.
Core Features & Use Cases
- Version-chain guidance: Explains how the migration runner stores version numbers per tenant and why CreateAsync must return the latest version while UpdateFromX methods are never renumbered.
- Schema and content definition operations: Covers altering content types and parts with IContentDefinitionManager, creating and altering SQL index tables with SchemaBuilder, patching existing content items via paged YesSql queries, and running recipe migrations.
- Provider-specific handling: Documents workarounds for SQLite's inability to drop columns, MySQL index key-length limits, and safe index dropping with try/catch guards.
- Use Case: You need to add a new column to an existing LinkFieldIndex table in a shipped module. The Skill directs you to append a new UpdateFromXAsync method using SchemaBuilder.AlterIndexTableAsync, bump the CreateAsync return value, and register the migration with AddDataMigration in Startup.cs.
Quick Start
Ask the assistant to create an OrchardCore data migration that adds a new content part and registers it in the module's Startup.cs.