-
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
ModelBuilder: QueryTypeBuilder.ToView continuously generates EnsureSchema in migrations. #14195
Comments
GetSchemas function needs to ignore QueryTypes when getting schemas since migrations don't deal with query types. |
Hello, I would try to prepare PR for this, if nobody is against it |
@Marusyk Sure, go for it. |
I don't understand how to ignore QueryTypes in GetSchemas (it's not so easy as I thought). So, it would be better to assign this task to someone else. Sorry. It is up-for-grabs again |
No worries, @Marusyk; We'll get to it sometime during the 3.0.0 release. |
Verified that both migrations do still contain EnsureSchema. Steps I did: (VS 2019 Enterprise 16.1.3)
Both still contain EnsureSchema @ajcvickers this doesn't appear fixed, I'm not sure what labels you want me to set for this, so I will just unassign this bug for now |
Note: I also tried fixing the obsolete warnings and used:
Which still has EnsureSchema in both migrations |
Thanks for checking. I have another related issue that may also fix this one. Applied the label too soon. 😉 |
When binding a
QueryType
to a view or table usingQueryTypeBuilder.ToView
and specifying a schema, anEnsureSchema
statement is created for theQueryType
in every subsequent migration. It doesn't break anything, but it does get a little bit tedious to keep picking the rogueEnsureSchemas
out of migration scripts.Steps to reproduce
QueryType
.dotnet ef migrations add Test
EnsureSchema
or to maybe even just have an empty migration since ensuring that the schema exists doesn't really help if the query is relying on existence of some SQL table or view that isn't being auto-generated by the migrationdotnet ef migrations add TestAgain
EnsureSchema
statementEfCoreViewWithSchema.zip
Further technical details
EF Core version: 2.2.0
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: Visual Studio 2019 16.0.0 Preview 1.1
The text was updated successfully, but these errors were encountered: