Options

Feature Request: store user default schema

meyerovbmeyerovb Posts: 21
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.

Comments

  • Options
    Thanks for your post.

    The default schema should be scripted for the database level users. For example, if you create:
    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
  • Options
    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.
  • Options
    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
Sign In or Register to comment.