You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to suggest one additional option to conditionally remove index creation.
There is a solution to conditionally remove indexes using convention.
But it is better to understand when model building and index creation located in one single place. For example, I configure model using IEntityTypeConfigaration and this is the only one place where every model is configured.
Describe the solution you'd like
It can looks like this:
// first option
builder
.HasOne(x => x.Product).WithMany().HasNoIndex();// second option
builder
.HasNoIndex(x =>new{ x.UserId, x.ProductId });
Also there is an extension for Postgresql "TimescalDb" and sometimes it doesn't allow to create foreign keys for time-series tables.
It can be useful to have API to skip creation foreign keys.
Not creating foreign keys in the database is tracked by #15854, you can follow that to be informed of progress.
Regarding not creating indexes... If you'd like to systematically stop creating indexes for foreign keys, that's something that generally belongs in a convention (like the one you linked to) - you should not be manually doing this for every index manually.
Otherwise, if you're really looking to selectively remove a specific index that's been configured by convention, @AndriySvyryd probably has the right answer (the metadata APIs can be used to manipulate indexes directly, but foreign key indexes are added only later...).
What problem are you trying to solve?
I want to suggest one additional option to conditionally remove index creation.
There is a solution to conditionally remove indexes using convention.
But it is better to understand when model building and index creation located in one single place. For example, I configure model using IEntityTypeConfigaration and this is the only one place where every model is configured.
Describe the solution you'd like
It can looks like this:
Also there is an extension for Postgresql "TimescalDb" and sometimes it doesn't allow to create foreign keys for time-series tables.
It can be useful to have API to skip creation foreign keys.
It can looks like this:
The text was updated successfully, but these errors were encountered: