Removing objects from git repo that have be subsequently filtered in SQL Source Control
Bugmeister
Posts: 21 New member
Hi,
It seems in SQL Source Control (SSC), if you had previously committed an object (say table A), but then later add a Filter into SSC to filter out table A, then the SQL file for table A still remains in the git repo.
Is there any easy way to remove objects from the SSC git that are no longer tracked (i.e. filtered out) in SSC? I could do the delete manually, but I'm sure I'd overlook some.
Thanks
Peter
It seems in SQL Source Control (SSC), if you had previously committed an object (say table A), but then later add a Filter into SSC to filter out table A, then the SQL file for table A still remains in the git repo.
Is there any easy way to remove objects from the SSC git that are no longer tracked (i.e. filtered out) in SSC? I could do the delete manually, but I'm sure I'd overlook some.
Thanks
Peter
Tagged:
Best Answer
-
David Atkinson Posts: 1,455 Rose Gold 2If you use SQL Compare (using the same filter) and script out your database to a scripts folder, then compare this scripts folder against the scripts folder in your Git repo, then you'll get a list of differences which should represent the objects that need to be removed from the repo. SQL Compare should be able to remove them for you if you run a deployment based on the comparison of both scripts folders, this time without the filter being used.David Atkinson
Product Manager
Redgate Software
Answers
Product Manager
Redgate Software
Yep your suggestion worked, with a few comments:
- Using File -> "Create Scripts Folder..." in SQL Compare 13, I couldn't figure out how to select/specify the existing Filter.scpf. Ended up using the command line sqlcompare.exe.
- Would be good if there were SQL Compare Powershell cmdlets.
- Once I had generated the scripts folder, I used the GUI to compare and found the extra files in repo. I used SQL Compare to apply the "deletion" however it seemed to only remove the contents of the SQL file, not delete it (that may have been something to do with my options in SQL Compare).
However those comments aside I managed to do what I required, so thanks!Cheers
Peter
Regarding the blanking of files rather than deleting them, I had forgotten about that. Sorry! I think this is because some version control systems don't like file deletions and will behave unexpectedly if the files disappear. I can't remember the precise details. I guess you would have had to delete the files manually? Anyway, good that it worked out in the end!
Product Manager
Redgate Software