dotnet / dotnet/efcore

Ability to add a blank migration even if you have model/schema changes in the code - Code First specifically

Open
#31,229 0 comments 1 reaction 0 assignees View on GitHub
area-migrations customer-reported
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

Reason: You have made significant changes and then realize that you need to run some raw sql commands before and/or after applying a migration with the model/schema changes. (example reason - but has applied to me.)

Solution - Add-Migration option to generate an "empty" migration - snapshot.cs does not change even if there are currently code/entity/schema changes in the codebase.

Possible to have just a switch on the add-migration command that creates an empty migration and, of course, adds the migration class designer file details of just the current model/database state? Current state could be copied from the previous migration designer file given one has requested an empty migration.

NOTE: I've figured out how to implement this type of solution using the current capabilities. Not too hard or anything but the approach I use is not documented. I'm not saying that this feature request is something needed by all but it is possible that one makes some changes and then realizes that they need an intermediary migration to achieve their full solution.

Thank you very much for any consideration of this request.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.