Overwriting object scripts in a scripts folder.

Forum for users of SQL Toolkit 3,4,and 5

Overwriting object scripts in a scripts folder.

Postby andy.c » Thu Jan 03, 2008 1:00 am

Hi,

Is there a way to set the script save behaviour in the Database.SaveToFolder method so that the object scripts can be overwritten instead of a new script file being created with a version number appended to the file name?

Thanks,

Andy
andy.c
 
Posts: 8
Joined: Thu Aug 02, 2007 9:58 pm

Something even stranger...

Postby andy.c » Thu Jan 03, 2008 11:24 pm

I have found some strange behaviour with the SQL Tookit which would like to get some clarification on.

When comparing one scripts folder to anther scripts folder I am getting some inconsistent behaviour.
If I update a source proc and then compare to the destination object and execute the script actions against the destination then the script file is updated as expected.
But if I delete a source proc and do the comparison and execution on the destination scripts folder the destination script file is emptied out (0 bytes) instead of being deleted.
Also if I restore the deleted source proc and then compare and execute on the destination scripts folder, the destination script file is not updated with the restored proc. Instead the file remains a 0 byte file and a new script file is created with the number 1 appended to the file name.

Is this behaviour by design?

This behaviour makes it difficult to build some kind of automated check in with source control (Subversion in this case).

I am using SQL Toolkit 6.

Thanks,

Andy
andy.c
 
Posts: 8
Joined: Thu Aug 02, 2007 9:58 pm

Postby Brian Donahue » Fri Jan 04, 2008 10:42 am

Hi Andy,

I think that the script to file engine works this way on purpose, specifically for the reason of source control. If it deletes the script file, it will appear in the source control as MISSING, which may lead people to the conclusion that SQL Compare ate the file. If it's replaced by a zero-length file instead, then you won't waste time trying to figure out why you have a missing file.
Brian Donahue
 
Posts: 6668
Joined: Mon Aug 23, 2004 10:48 am

Postby Michelle Taylor » Tue Jan 08, 2008 12:38 pm

I have added a feature request to the SQL Compare project for SQL Compare to write objects into zero-length files instead of treating them like other pre-existing files that might have something important in and need to be preserved. Does this cover the behaviour you were looking for?
Michelle Taylor
 
Posts: 529
Joined: Mon Oct 30, 2006 12:45 pm
Location: Red Gate Software


Return to SQL Toolkit Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests