Feature suggestion: User scripts

Feature suggestion: User scripts

I've noticed that dbForge SQL Source Control only offers to commit users as `WITHOUT LOGIN` and, even if a file is committed for a user that creates the user `FOR  LOGIN`, the "get latest" operation will still create the user `WITHOUT LOGIN`. I also tried to test what would happen if the user file checked for the existence of the login, creating the user `FOR LOGIN` if the login exists and `WITHOUT LOGIN` if not. This caused an error, with dbForge detecting the second command as a duplicate user within the commit.

Would you consider a set of options (perhaps not a default behavior) to modify this? What I envision, and would work best for my use case, would be if committing a user that exists in the database `FOR LOGIN` resulted in a script like the following:

  1. IF EXISTS (SELECT * FROM master.dbo.syslogins WHERE loginname = N'example')
        CREATE USER [example] FOR LOGIN [example]
    ELSE
        CREATE USER [example] WITHOUT LOGIN
    GO



I could also imagine it being desirable at least to raise a warning from the tool if the login doesn't exist, and possibly to have an alternative setting (probably at a per-database level, possibly even a decision made when committing the user) where trying to create the user without the login existing first would not only warn, but refuse to execute.

I imagine it is also possible that the desire of some users, and possibly dbForge's eventual intent, is that if the dbForge user wants a particular database user to be handled in a manner like this, they would need to use a future filter implementation to tell dbForge to ignore that object for purposes of versioning. Or maybe there's some other technical reason something similar to this may have been considered and rejected in the past, or it might just seem a sufficiently customer-choice-dependent behavior not to be worth implementing. I actually rather approve of the fact that, unlike one of your competitors (at least in the past), you don't script the creation of a missing login with some kind of default password, so it wouldn't surprise me if there is a good reason this option doesn't appear to exist.