Managing Permissions between environments
cousinsp
Posts: 29
We've just started using SQL Source Control (with VisualSVN server). Loving it. We have dev, test and live SQL Servers. We're now obviously trying to ensure that database code, schema etc. do not have to change between environments - makes my as a dba a job a lot easier. We're hitting a problem with permissions - the database in test needs a certain AD group to access it, which is a different group from live. I've proposed the use of database roles - which is great for the SQL code for tables etc., but the script to create the database role is different for each environment (got different users in the role). How do I handle that with SQL Source control, or is there another way?
Pete Cousins
Comments
To achieve this, assuming you use SQL Compare to push changes to live, ensure the 'Ignore Permissions' option is selected before running the comparison to avoid your test permissions to be moved across.
I'd be interested to know if this approach would work for you so do let us know how you get on.
Kind regards,
David Atkinson
Red Gate Software
Product Manager
Redgate Software
At the moment I'm excluding the definition of the database role from Source Control, but including the permissions granted to the role on table definitions etc. Just need to make sure the role is in each environment before code is deployed.
It gets a bit confusing as SQL compare picks up the role when I do deployments, so I have to actually read the screen and check the right objects before deploying. Wouldn't it be nice just to be able to do a quick check and click 'deploy'. Can objects be excluded from the compare?
Pete Cousins
Let us know if you manage to get this working in your environment. And of course if there's a modification we can make to existing behavior that would better suit your needs, please do let us know.
David
Product Manager
Redgate Software