SSDT schema compare, removing and then renaming stored procedure result is incorrect
-
19-12-2020 - |
Question
The initial setup contains two scripts:
stored_procedure.sql
stored_procedureV2.sql
What I did is:
- Remove
stored_procedure.sql
- Rename
stored_procedureV2.sql
tostored_procedure.sql
When I perform a schema compare in SSDT between a .dacpac
not containing this change and my project the action it proposes is to just remove stored_procedure.sql
and do nothing else, whilst it should remove stored_procedureV2.sql
and update stored_procedure.sql
to its new content.
As I assume this is where schema compare gets its information:
The .sqlproj
of the source:
...
<Build Include="Scripts\stored_procedure.sql">
<AnsiNulls>On</AnsiNulls>
<QuotedIdentifier>On</QuotedIdentifier>
</Build>
<Build Include="Scripts\stored_procedureV2.sql">
<AnsiNulls>On</AnsiNulls>
<QuotedIdentifier>On</QuotedIdentifier>
</Build>
...
The .sqlproj
of the target:
...
<Build Include="Scripts\stored_procedure.sql">
<AnsiNulls>On</AnsiNulls>
<QuotedIdentifier>On</QuotedIdentifier>
</Build>
...
Is this a known issue? Do I need to perform this in two steps? Is there a way to make SSDT behave the way I want?
Solution
The issue was that stored_procedure.sql
still had stored_procedureV2
as procedure name. Then SSDT actually does a correct compare by saying: stored_procedureV2.sql
is unchanged and stored_procedure.sql
is removed.