-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrations: multiple references to the same owned type carries into subsequent migrations #12107
Comments
@bricelam Any update on the investigation here? Specifically, is it something we might want to patch? |
Something strange is going on when building the model in the snapshot. The |
Removing these lines from the snapshot fixes the issue for one migration. (They're re-scaffolded into the next snapshot). b2.Property<int>("OrderDetailsOrderId")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b2.HasOne("OwnedTypeMigrationTest.OrderDetails")
.WithOne("StreetAddress")
.HasForeignKey("OwnedTypeMigrationTest.StreetAddress", "OrderDetailsOrderId")
.OnDelete(DeleteBehavior.Cascade); |
Here are the interesting parts of the debug view:
|
@AndriySvyryd Did you get a chance to look at this with regard to whether we should try to patch? June patch deadline is tomorrow. |
@ajcvickers I'm still investigating |
Moving this to 2.1.3, since 2.1.1 is now in escrow. |
…pshot. Fix ShortName() for shadow entity types. Make the shadow property for identifying FKs be of a non-nullable type in more cases. Port of #12107 fix
…pshot. Fix ShortName() for shadow entity types. Make the shadow property for identifying FKs be of a non-nullable type in more cases. Port of #12107 fix
This is approved for 2.1.3. Do not merge yet; branch is expected to open Monday. Given these issues have been parked for some time, please be careful to ensure the correct commits get into the correct branches. |
@AndriySvyryd This issue is approved for patch and the release\2.1 branch is now open for merging. Please ensure:
|
Consider a model with where multiple entities contain the same owned type. There are three entities: two of the same type, and one of a different type. If they call contain the same owned type, then subsequent migrations try to drop the owned type. Please see the code example below. No model changes are made between the migrations for clarity.
Steps to reproduce
Commenting out either line below (and the corresponding lines in OnModelCreating) fixes the problem.
Here are the contents of the migration files:
20180522184202_MyFirstMigration.cs
20180522184211_MySecondMigration.cs
Further technical details
EF Core version: v2.1.0-rc1-final
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10 Pro 17134.48
IDE: Visual Studio 2017 15.7.1
The text was updated successfully, but these errors were encountered: