-
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
Reverse Engineer: Scaffolding fails on Azure Sql Server v11 and SQL 2008 because sequences are not supported #5553
Comments
Ah Sequence issue. We are trying to get metadata about sequences but not all version of Sql Azure supports sequences so database error. |
The server hosting my database describes the following features:
|
Do a SELECT @@Version |
@lajones - this check is not correct for Azure SQL database:
Probably need IsAzureSqlDatabase (SERVERPROPERTY('EngineEdition') = 5) in the class as well
|
Microsoft SQL Azure (RTM) - 11.0.9231.349
Off in the weeds: |
@mhenderson442 Azure SQL database has version 11 and 12, it is possible to update from 11 to 12: https://azure.microsoft.com/da-dk/documentation/articles/sql-database-upgrade-server-portal/ |
@ErikEJ Just saw that I can upgrade and am doing so. |
@mhenderson442 Great idea, that should unblock you! |
Upgrading to to version 12 unblocked me and I successfully executed Scaffold-DbContext. @smitpatel @ErikEJ Should this issue be closed, or leave it open till the version 11 scenario is addressed? |
As long as Azure supports v11 databases, I vote for a bug fix |
As as @ErikEJ said, since there are Azure database v11 out there, EF should not fail like that and have better check for server version. Leave this issue open please. |
Agreed. I will leave open. |
@mhenderson442 how did you get the scaffolding output log? all I get is "build failed." |
Guys I get this issue and have verified my Azure SQL DB is version 12. Anybody know how to turn on verbose logging for Scaffolding-DbContext? |
@markti I don't recall as it was more than a year ago I wrestled with this issue. |
@markti - Use |
We already do sequences conditionally, Does this still fail? |
Yes, this is still an issue, if you wish to continue to support Azure SQL Database v11, which has been retired: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-faq - othewise close See my comment above: #5553 (comment) |
Thanks @ErikEJ - I missed that condition was incorrect. Probably should just fix this if we plan to support. |
Azure Data Warehouse uses a different version numbering scheme. The latest version at this date is 10.0.9999.0. Maybe it should check the compatibility level, rather than the version number. The compatibility level is 130, which is probably fine. Edit: looks like Azure Data Warehouse doesn't currently support sequences. Thus, the compatibility level would not actually detect this. Ideally, a real feature detection would be attempted, such as seeing if a query on sys.sequences returns anything. Here's my attempt |
Triage: we should try to not need to check for whether a feature is available, or if we do we should find the most appropriate way to use version number, compatibility level, or whatever else to determine what is supported. |
Use compatibility_level for feature detection Unblock scaffolding on Azure SQL DW fixes dotnet#14566 fixes dotnet#5553
Steps to reproduce
Scaffold-DbContext -Provider "Microsoft.EntityFrameworkCore.SqlServer" -Context "DbMercurySchool" -OutputDir "DataModel" -Connection "Server=[Sql Azure Database Server];Data Source=[Sql Azure Database];Initial Catalog=MercurySchool;Persist Security Info=False;User ID=[User ID ];Password=[My Password];Pooling=False;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
The issue: SQL error thrown
Error Number:208,State:1,Class:16 One or more errors occurred. (Invalid object name 'sys.sequences'.)
See attached file.
scaffold_error.txt
EF Core
1.0.0-rc2-final
Other details about my project setup:
So far database has one table. The schema for the table is
academy
notdbo
.The text was updated successfully, but these errors were encountered: