Feature Request: store user default schema

A SQL Server Management Studio add-in to source control your database in Subversion or Team Foundation Server.

Moderators: Chris Auckland, David Atkinson, sherr, PhilScrace

Feature Request: store user default schema

Postby meyerovb » Wed Apr 13, 2011 6:27 pm

I create a user, it stores the username and owned roles (db_owner), but it doesnt store the default schema, which is important in my case.
meyerovb
 
Posts: 13
Joined: Thu Dec 09, 2010 1:04 am

Postby Chris Auckland » Mon Apr 18, 2011 4:27 pm

Thanks for your post.

The default schema should be scripted for the database level users. For example, if you create:

Code: Select all
CREATE USER [test] FOR LOGIN [test] WITH DEFAULT_SCHEMA=[test_schema]


This will be added to the repository.

How are you creating the user?
Chris
Chris Auckland
 
Posts: 757
Joined: Tue Oct 24, 2006 2:12 pm
Location: Red Gate Software Ltd.

Steps to reproduce

Postby meyerovb » Tue Apr 19, 2011 2:23 pm

Create DB1, create Schema1, create User1 with default schema Schema1, link to source control and commit.

Create DB2, create User1 with no default schema, link to DB1 source control directory, get latest. Schema1 is created, but User1 is not set to default schema Schema1.
meyerovb
 
Posts: 13
Joined: Thu Dec 09, 2010 1:04 am

Postby Chris Auckland » Thu Apr 21, 2011 3:25 pm

Thanks for your reply, I can see what you mean now.

Unfortunately, the default_schema setting is a user property that is automatically ignored by SQL Source Control. SQL Source control uses our SQL Compare engine to compare the differences between the live database and what's stored in Source Control. It's a default option in SQL Compare to ignore the 'user properties' and SQL source control uses the default SQL Compare options. We have an open feature request to allow the user to configure the SQL Compare engine options, which you might like to vote for here

Currently the only workarounds I can think of are:

1) Delete user1 from DB2 and then 'get' the complete user from source control.
2) Use SQL Compare to deploy the user from Source Control to the database, and turn off the option: 'ignore' > 'user properties'

I hope this helps explain.

Let me know if you need any more information.
Chris
Chris Auckland
 
Posts: 757
Joined: Tue Oct 24, 2006 2:12 pm
Location: Red Gate Software Ltd.


Return to SQL Source Control 2

Who is online

Users browsing this forum: No registered users and 0 guests