chucknorris / roundhouse

RoundhousE is a Database Migration Utility for .NET using sql files and versioning based on source control
http://projectroundhouse.org
920 stars 247 forks source link

Documentation: AnyTimeScript behaviour when script is deleted #345

Open littlefyr opened 5 years ago

littlefyr commented 5 years ago

It is not clear from the docs what happens when an anytime script is deleted or renamed (which is the same as delete and add, particularly when the code changes). Because RH tracks changes to scripts, and the convention is to name each script by the thing it defines, one might come to the conclusion that removing a script will remove the thing that it managed.

Without looking at the code, that seems difficult to do that correctly, but it would be helpful the behaviour (which I assume is that RH will simply ignore the thing defined in the deleted script, and renaming will have the side effect of drop/create or create/apply even if there are no changes to the script) was explicitly stated along with a template for deleting the thing you no longer want.

ferventcoder commented 5 years ago

It's probably best to keep or rename the script and explicitly delete the thing in the script itself. That seems the cleanest and least amount of surprising behavior.

As there are known uses cases where multiple areas run RH against the same DB with different sets of anytime scripts, it would be dangerous to make the assumption that if something is missing it should be removed.

ferventcoder commented 5 years ago

So what I'm saying is, if you need to delete something, change the anytime script to do that and just that (perhaps make an exists check first). Then maybe also rename the script to have something like _DELETED.sql appended to the name. And yes, documentation on this agreed approach would be good to add.