migrating-ravens / RavenMigrations

A small migrations framework to help you manage your RavenDB Instance.
MIT License
53 stars 24 forks source link

Introduced the concept of a Hotfix #14

Closed danielmarbach closed 6 years ago

danielmarbach commented 10 years ago

As discussed on twitter I introduced the concept of a Hotfix. I decided to duplicate the code for the moment. I wanted to do it with the least amount of effort but including tests because I don't know if you want it in the migration library or not (but would be awesome).

As we see it Hotfixes are only applied once and only a specific hotfix. That is why this PR provides a HotfixRunner where you can say which version or hotfix name you want to apply (see tests for the usage).

danielmarbach commented 10 years ago

By the way we are already using this in production. If you want I could also send a seperate pull for a command line interface

dportzline83 commented 9 years ago

What's the main advantage of having a separate concept for a Hotfix, do you think? I'm not quite seeing the difference in use-case vs. a regular migration. How are you using them?

danielmarbach commented 9 years ago

When we used that in the previous projects we were long discussing the difference between a migration and a hotfix. For us a migration was something you apply an ordered fashion from the first migration to the nth migration. Migrations can also be applied to the database in an idempotent manner. For us a hotfix was something we needed to do as a one time shot to do an immediate change on the data. That's why we separated those two concepts. So in order to apply a hotfix you need to be very specific what you want to do.

With that hotfix concept we could bring those scripts under source control as well.

dportzline83 commented 9 years ago

Ok, so what would be a situation where you could not use a migration to do what you're describing? Are you thinking in terms of a data corruption issue that has occurred in only one environment, so you need to apply a script to fix it on that one place specifically? Could you use the migration profiles for that instead?

danielmarbach commented 9 years ago

Look to be frank. I'm away from that project. Maybe @fabiantrottmann or @froko can shed light onto that. And personally I just don't care anymore. I provided that PR as a potential feature. We have been using the my fork because the project was essentially dead for a while. If it doesn't fit your goals that perfectly fine. I have no feelings attached to that change :D

dportzline83 commented 9 years ago

Yeah, I'm not necessarily opposed to it. I'm just trying to understand the need for it better. If we did decide to move forward with the hotfix idea, I'd certainly like to clean up the code duplication etc. Let me know if that's something you'd want to tackle, or if you'd prefer to just close this. I'd be interested to hear what your colleagues have to say as well.

smerrell commented 9 years ago

Thanks for the Pull Request! I definitely see value in having the notion of a one off migration that only needs to be run once and doesn't leave behind a migration document. I also think it is useful if you want to preserve what you did with the hotfix instead of just using the Raven Patching API directly.

There is definitely code duplication here but I'd like to look at this and see if there is something we could use from this Pull Request. Again, thanks for the PR!