Expected Synonym Behavior

SQL Change Automation doesn't appear to detect differences in the base_object_name of a synonym.  Consider the following:
1. The synonym is deployed from source control if it doesn't exist in the target DB. << as intended
2. The synonym is dropped from the target DB if it doesn't exist in source control. << as intended
3. No action is taken to deploy a new version of the synonym if the base object referenced by the synonym is different between source control & the target DB.

Does anyone know if this behavior is by-design?
Tagged:

Best Answers

  • Sergio RSergio R Posts: 610 Rose Gold 5
    No, this is not expected.
    Maybe you are excluding synonyms in step 3 using a filter?
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
  • Sergio RSergio R Posts: 610 Rose Gold 5
    <IgnoreDatabaseAndServerName>True</IgnoreDatabaseAndServerName> means that if the synonym exists in both source and target and the only difference is database and server name, then it will be considered identical and no differences will be deployed

    In your case since you set it to False it considers synonyms to be different, if either the database or server name are different and will deploy these differences

    I wouldn't say it's unsafe to set this option, as long as you are aware of its consequences
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools

Answers

  • ShaggyShaggy Posts: 16 Bronze 1
    I don't believe this is the case.

    The synonym section of my filter.scpf is:

          <Synonym version="1">
            <Include>True</Include>
            <Expression>TRUE</Expression>
          </Synonym>

    My ComparisonOptions.xml file contains this entry:

    <IgnoreSynonymDependencies>False</IgnoreSynonymDependencies>
  • ShaggyShaggy Posts: 16 Bronze 1
    We invoked the desired behavior for scenario #3 by changing this option to false:
    <IgnoreDatabaseAndServerName>False</IgnoreDatabaseAndServerName>

    Can you confirm if this is valid/safe?
Sign In or Register to comment.