-
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
Exclude only base type table from Migrations #30079
Comments
Note to implementor: Add TPC condition to: efcore/src/EFCore.Relational/Extensions/RelationalEntityTypeExtensions.cs Lines 1455 to 1458 in 03bb7b7
Also check that the dependent is mapped to the same table in: efcore/src/EFCore.Relational/Extensions/RelationalEntityTypeExtensions.cs Lines 1461 to 1465 in 03bb7b7
Change to ||: efcore/src/EFCore.Relational/Migrations/Internal/MigrationsModelDiffer.cs Lines 560 to 561 in 03bb7b7
Check efcore/src/EFCore.Relational/Migrations/Internal/MigrationsModelDiffer.cs Lines 2201 to 2202 in 03bb7b7
|
Note from triage: this is a bug, but fix should be documented as a breaking change since TPT cases where all tables were excluded will now only exclude the base table. |
Originally filed as #2725 (comment) by VeMike
So how would I ignore just a base class, but not a derived class using this approach?
Consider the following model:
The database context for this model is the following
As you can see I only want
Developer
to be in the migration.Human
should be excluded. Why would I want to do this? I am extending an existing model and the base (Human
) already exists in the database. I want to addDeveloper
to this existing model.But if I create a migration the whole hierarchy of
Human
is excluded (basically all classes of typeHuman
). But I want theDeveloper
to be created.Of course, I could just remove the line
and then manually remove the added
Human
from the migration. But is there a way to do this automatically?The text was updated successfully, but these errors were encountered: