Syncing permissions between a Database project and a database using Visual studio
-
22-07-2019 - |
Question
I have a database project in visual studio (2008) that I am using to keep my database structure in a version control system (Git). I use the data schema compare tool in VS to maintain this database project. The issue that I'm encountering is that I keep losing my permissions for new objects.
So how do I:
- Capture these permissions using the schema compare tool.
- Apply these permissions to a server using the schema compare tool.
Solution
The easiest method to capture and apply the permissions that I have found is to go into tools -> options -> database tools -> schema compare and uncheck the ignore permissions checkbox. Then run the schema comparision and apply updates.
Note: That this will update every object with permissions in your schema. I have been capturing the permission after I sync my schema changes and then resetting the ignore permissions checkbox