Comparison of source control & database not refreshing views
matt_hosking
Posts: 20
I've just recently switched from script vs database comparison to source control vs database comparison (in order to support migration scripts) and noticed that views are no longer being refreshed when objects they are dependent on are modifed (i.e. a table is changed and views that use it don't get refreshed).
Is this a bug or is there a setting to fix this behaviour? My options are currently 'if,ifg,iw,ie,iq,nt,iu,iup,ip,nc' and I've tried adding 'incd' (include dependencies) but this works the reverse way (modify a function that uses a view and the view gets refreshed).
Is this a bug or is there a setting to fix this behaviour? My options are currently 'if,ifg,iw,ie,iq,nt,iu,iup,ip,nc' and I've tried adding 'incd' (include dependencies) but this works the reverse way (modify a function that uses a view and the view gets refreshed).
Comments
"C:\Program Files (x86)\Red Gate\SQL Compare 10\SQLCompare.exe" /sourcecontrol1 /revision1:Latest /scriptsfolderxml:"%teamcity.build.checkoutDir%\Build\compare.xml" /migrationfolderxml:"%teamcity.build.checkoutDir%\Build\migration.xml"
/scripts2:"%teamcity.build.checkoutDir%\sourcedb" /options:if,ifg,iw,ie,iq,nt,iu,iup,ip,nc /scriptfile:"%teamcity.build.checkoutDir%\Build\Scripts\%Version%b.sql"
Where %Version% = 4.0.0 (at the moment), check out dir is agent-side default check out dir and the sourcedb folder is the source-controlled (SQL Source Control) schema folder for the version to compare against (couldn't see how to supply 'scriptsfolderxml' for the second source control).
Compare.xml
<?xml version="1.0" encoding="utf-16" standalone="yes"?>
<!--
SQL Compare 10
SQL Compare
Version:10.1.0.102-->
<ISOCCompareLocation version="1" type="SvnLocation">
<RepositoryUrl>http://[removed]/trunk/database/Schema/</RepositoryUrl>
</ISOCCompareLocation>
Migration.xml
<?xml version="1.0" encoding="utf-16" standalone="yes"?>
<!--
SQL Compare 10
SQL Compare
Version:10.1.0.102-->
<ISOCCompareLocation version="1" type="SvnLocation">
<RepositoryUrl>http://[removed]/trunk/database/Migration Scripts/</RepositoryUrl>
</ISOCCompareLocation>
If this doesn't work, then your database in particular must have a dependency chain that is confusing to SQL Compare. We'll probably need schema snapshots to reproduce the issue in house so we can try to fix it.
Thanks for the reply, but as I mentioned, I've already tried the 'incd' option, which appears to do the reverse - updates only objects that the current object is dependent on (e.g. function depends on a view), rather than the other way - update the objects that depend on the current object (e.g. views that depend on a table), which I want.
Could this have something to do with migration scripts? Have you tested using the exact command line parameter set? I've found that they do seem to interact somewhat in expected ways when used differently from the norm.
Default,ie,iq,nt,iu,ip,nc
and everything is working. This should have been equivalent to:
if,ifg,iw,ie,iq,nt,iu,iup,ip,nc,incd
shouldn't it? This set was only missing 'DecryptPost2KEncryptedObjects', 'IgnoreWithElementOrder' and 'IgnoreDatabaseAndServerName' but none of those should have affected the dependencies I would think. Is there something undocumented in the 'Default' option?
I'll have to check the command-line parser code.