Azure SQL is not supported
rouke-broersma opened this issue · 6 comments
DB_ID always returns NULL for azure sql (single database).
We could instead use
"IF NOT EXISTS(SELECT * FROM master.sys.databases WHERE name='Notification') CREATE DATABASE Notification;"
The USE command is also not allowed on azure sql single database which is used by ChangeDatabase: https://github.com/EdwinVW/pitstop/blob/master/src/NotificationService/Repositories/SqlServerNotificationRepository.cs#L44
We can replace this with closing the sql connection to master and creating a new sql connection to the target database.
This does work on azure sql. Would this change be acceptable?
Yes that's fine - providing it also keeps working on SQL Server (which I assume is the case).
Can you check whether this is sufficient to fix the issue?
This is the same change we made to our fork 👍
The only difference is that we did a conn.OpenAsync();
in the new connection scope but if you say the change works fine without it on SQL server then I guess it's not neccesary? 🤷
Yes, it makes sense to explicitly open the connection. I'll create a fix for that.