Repository navigation
Breaking change note: migrations --output-dir now also places the model snapshot - #5511
Draft
ajcvickers wants to merge 1 commit into
Draft
ajcvickers wants to merge 1 commit into
ajcvickers wants to merge 1 commit into
Conversation
…tput-dir See dotnet/efcore#24339 and dotnet/efcore#39565 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new EF Core 12 breaking-changes page has an active navigation omission and two wording inaccuracies that should be corrected before publication.
3 open issues
What changed in this PR
This draft PR starts the EF Core 12 breaking-changes page. It documents one change: dotnet ef migrations add --output-dir (and Add-Migration -OutputDir) now writes the model snapshot to the output directory too. The page is meant to be published once the linked efcore PR (dotnet/efcore#39565) merges.
Changes:
- Adds the new page with front matter, links to earlier breaking-change pages, and a summary table.
- Adds a low-impact entry covering the old and new snapshot behavior, how an existing snapshot is moved or kept, the
--dry-runbehavior, the newPreviousSnapshotFileproperty, the reasons for the change, and mitigations for users who pass a different--output-dirfor each batch.
| File | Description |
|---|---|
| entity-framework/core/what-is-new/ef-core-12.0/breaking-changes.md | New EF Core 12 breaking-changes page that documents the snapshot now following --output-dir, with mitigations. |
Review effort: Lite
| @@ -0,0 +1,56 @@ | |||
| --- | |||
|
|
||
| When `--output-dir` is specified, the model snapshot is written to that directory as well, together with the migration and designer files. This applies to relative paths, to paths outside the project directory, to absolute paths, and when `--namespace` is also specified. | ||
|
|
||
| If the context already has a snapshot in a different file, the new snapshot is written first and the old file is then deleted, so that only one snapshot remains. The old file is deleted only when exactly one file in the project or the output directory declares the snapshot class. If there are several, or the existing snapshot can't be found, nothing is deleted and a warning is reported. If a file with the snapshot's name already exists in the output directory but declares a different class, such as the snapshot of another `DbContext`, the command fails instead of overwriting it. |
|
|
||
| - If you pass a different `--output-dir` for each batch of migrations, for example `Migrations/2025` and then `Migrations/2026`, the snapshot now moves each time. Use the same output directory for every migration, or omit `--output-dir` after the first one to keep new files beside the existing ones. | ||
| - The snapshot's path changes when it moves. Make sure the new path is committed and, if your project lists compile items explicitly, included in the project. The Package Manager Console updates these project items for you. | ||
| - If the snapshot is outside the project directory, pass the same `--output-dir` to every `migrations add` command. Otherwise EF can't find the existing snapshot, warns, and writes a second one inside the project. |
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.


Breaking change note for dotnet/efcore#39565, which makes
dotnet ef migrations add --output-dirwrite the model snapshot to the output directory too (tracking issue dotnet/efcore#24339). Previously the snapshot stayed beside the existing snapshot, so using a different--output-dirper batch of migrations now moves the snapshot each time.There are no EF Core 12 docs yet (
mainof dotnet/efcore is 12.0, andrelease/11.0has branched), so this starts the EF Core 12 breaking changes page with just this entry, like the first EF Core 11 breaking change note did. I haven't touchedtoc.yml, the 12.0 what's-new page, or the existing pages.This is a draft until the efcore PR is merged. The follow-up efcore PRs (
migrations remove --output-dir, dotnet/efcore#39567, and theEFMigrationsOutputDirproperty, dotnet/efcore#39568) are not described here since they are not breaking changes and are not merged.🤖 Generated with Claude Code