Expand and clarify migrations guidance. - #5445
Open
AndriySvyryd wants to merge 3 commits into
Open
Conversation
Fixes #736 Fixes #1043 Fixes #2952 Fixes #3258 Fixes #3425 Fixes #3426 Fixes #3444 Fixes #933 Fixes #3835 Fixes #5323 Fixes #4954 Fixes #4914 Fixes #4913 Fixes #4924 Fixes #4768 Fixes #4703 Fixes #4650 Fixes #4332 Fixes #4318 Fixes #4304 Fixes #4266 Fixes #4230 Fixes #3724 Fixes #3560 Fixes #3061 Fixes #3418 Fixes #2355 Fixes #2270 Fixes #2147 Fixes #1879 Fixes #1342 Fixes #807 Fixes #691 Fixes #564
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands and clarifies EF Core migrations guidance across multiple docs pages, and adds/updates samples to support the recommended workflows (separate migrations project, migration bundles, data operations in migrations, and corrected custom operation SQL generation).
Changes:
- Improve migrations documentation around team workflows, deployment strategies (scripts vs bundles vs tooling), and separate migrations projects.
- Add new samples for a migration bundle workflow and for design-time
DbContextcreation in a separate migrations project. - Fix and extend sample code used in docs (e.g., custom migration operation type mapping, new data-operations snippets).
Reviewed changes
Copilot reviewed 25 out of 27 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| samples/core/Schemas/ThreeProjectMigrations/WebApplication1/WebApplication1.csproj | Simplifies reference to migrations project for the 3-project sample. |
| samples/core/Schemas/ThreeProjectMigrations/WebApplication1.Migrations/WebApplication1.Migrations.csproj | Adds EF design-time and provider packages to support tooling in migrations project. |
| samples/core/Schemas/ThreeProjectMigrations/WebApplication1.Migrations/ApplicationDbContextFactory.cs | Adds design-time factory used by docs/tools for separate migrations project. |
| samples/core/Schemas/ThreeProjectMigrations/WebApplication1.Data/WebApplication1.Data.csproj | Updates package versions to align with the sample’s target framework/version set. |
| samples/core/Schemas/Migrations/DataOperations.cs | Adds migration data-operation examples for docs snippets. |
| samples/core/Schemas/Migrations/CustomOperation.cs | Fixes string type mapping acquisition in custom operation sample. |
| samples/core/Schemas/MigrationBundle/Program.cs | Adds a small verification entrypoint for the migration bundle sample. |
| samples/core/Schemas/MigrationBundle/Migrations/BloggingContextModelSnapshot.cs | Adds model snapshot for the migration bundle sample. |
| samples/core/Schemas/MigrationBundle/Migrations/20260805232730_AddIsActive.Designer.cs | Adds generated designer for the second migration in the bundle sample. |
| samples/core/Schemas/MigrationBundle/Migrations/20260805232730_AddIsActive.cs | Adds the second migration in the bundle sample. |
| samples/core/Schemas/MigrationBundle/Migrations/20260805232705_InitialCreate.Designer.cs | Adds generated designer for the initial migration in the bundle sample. |
| samples/core/Schemas/MigrationBundle/Migrations/20260805232705_InitialCreate.cs | Adds the initial migration in the bundle sample. |
| samples/core/Schemas/MigrationBundle/MigrationBundle.csproj | Introduces a new sample project for migration bundles. |
| samples/core/Schemas/MigrationBundle/BloggingContextFactory.cs | Adds design-time factory for the bundle sample context. |
| samples/core/Schemas/MigrationBundle/BloggingContext.cs | Adds a context with seeding delegates and schema-existence checks for rollback safety. |
| samples/core/Schemas/MigrationBundle/Blog.cs | Adds the sample entity type. |
| samples/core/Samples.sln | Registers the new MigrationBundle project in the samples solution. |
| entity-framework/core/modeling/data-seeding.md | Clarifies seeding behavior during deployment/migrations and links to bundle/script tradeoffs. |
| entity-framework/core/managing-schemas/migrations/teams.md | Adds guidance for diverged migration trees and source-control rollbacks. |
| entity-framework/core/managing-schemas/migrations/projects.md | Rewrites/expands separate migrations project guidance with a 3-project layout and tooling commands. |
| entity-framework/core/managing-schemas/migrations/operations.md | Adds guidance pointing readers at built-in data operations before custom operations. |
| entity-framework/core/managing-schemas/migrations/managing.md | Expands “data operations” coverage and adds guidance for removal/listing/squashing scenarios. |
| entity-framework/core/managing-schemas/migrations/index.md | Updates overview guidance with pointers to projects/bundles/scripts and next steps. |
| entity-framework/core/managing-schemas/migrations/applying.md | Adds a deployment strategy matrix and expands bundle/script/environment guidance. |
| entity-framework/core/cli/powershell.md | Adds warning clarifying Update-Database -Migration downgrade behavior. |
| entity-framework/core/cli/dotnet.md | Adds warning clarifying dotnet ef database update <migration> downgrade behavior and --output note. |
| entity-framework/core/cli/dbcontext-creation.md | Clarifies design-time factory precedence and updates references/links. |
Files not reviewed (2)
- samples/core/Schemas/MigrationBundle/Migrations/20260805232705_InitialCreate.Designer.cs: Generated file
- samples/core/Schemas/MigrationBundle/Migrations/20260805232730_AddIsActive.Designer.cs: Generated file
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 27 changed files in this pull request and generated no new comments.
Files not reviewed (2)
- samples/core/Schemas/MigrationBundle/Migrations/20260805232705_InitialCreate.Designer.cs: Generated file
- samples/core/Schemas/MigrationBundle/Migrations/20260805232730_AddIsActive.Designer.cs: Generated file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #736
Fixes #1043
Fixes #2952
Fixes #3258
Fixes #3425
Fixes #3426
Fixes #3444
Fixes #933
Fixes #3835
Fixes #5323
Fixes #4954
Fixes #4914
Fixes #4913
Fixes #4924
Fixes #4768
Fixes #4703
Fixes #4650
Fixes #4332
Fixes #4318
Fixes #4304
Fixes #4266
Fixes #4230
Fixes #3724
Fixes #3560
Fixes #3061
Fixes #3418
Fixes #2355
Fixes #2270
Fixes #2147
Fixes #1879
Fixes #1342
Fixes #807
Fixes #691
Fixes #564