ef-enum-to-lookup icon indicating copy to clipboard operation
ef-enum-to-lookup copied to clipboard

Breaks on Azure SQL Db "sys.sp_addextendedproperty"

Open 12c4IT opened this issue 10 years ago • 5 comments

Hi Tim,

If you try and use it when deploying to Azure you will get the error "Could not find stored procedure 'sys.sp_addextendedproperty'. " (Azure SQL does not support this).

It looks as though you are only using this proc to add the "Automatically generated..." description. Could we add this as an option? So we can turn it off if deploying to Azure?

I downloaded code and removed the lines that add the description and tested deploying to Azure and works.

https://github.com/timabell/ef-enum-to-lookup/blob/master/EfEnumToLookup/LookupGenerator/SqlServerHandler.cs#L64-L65

Thanks.

12c4IT avatar Apr 14 '15 02:04 12c4IT

Well that's rather annoying! shame on microsoft for not supporting documentation any more.

It might be better if the generated sql were to detect that it's running on sql rather than require the dev to know about this quirk. I'll take a look when I get a moment. If you'd like to do a pull request let me know and I'll hold off so we don't duplicate the effort.

Thanks for reporting this.

timabell avatar Apr 14 '15 08:04 timabell

I'm happy to look at it. Just not sure what the best approach would be?

Possibly using DbContext to open a connection and determine the version inside your GetDbHandler method? Not sure how this would affect MariaDB etc for your future enhancements?

12c4IT avatar Apr 15 '15 21:04 12c4IT

I'd want to do it in pure SQL because the library now supports generating a migration sql script for a DBA to run.

Note to self: http://stackoverflow.com/questions/1375934/how-can-i-detect-which-version-of-sql-eg-sql-2008-or-sql-azure

timabell avatar Apr 15 '15 21:04 timabell

I seem to be rather short on time at the moment.

timabell avatar Apr 20 '15 09:04 timabell

http://stackoverflow.com/q/12458292/10245 - how to document schema for azure (you don't, ffs microsoft) so we're down to detecting if that proc exists and only using it if it does.

  • Given that the generated sql may be run by a dba the detection has to happen within the generated sql.
  • I don't want to just detect that it is azure in case microsft add/remove this proc from various versions of sql server in the future.

Ask the internet: http://dba.stackexchange.com/q/98867/33693

timabell avatar Apr 25 '15 21:04 timabell