TL;DR is there any tool for managing (auto-creating, executing) migrations (using native .NET language) for NHibernate?
I come from Django background which encourages to develop Code-First. There's also the de-facto "industry standard" library for migrations, called South. The typical workflow for changing the schema is following:
this is very convenient not only for development (even SCRUM where things change so fast) but also for updating production - just make sure to keep the migrations on dev-machines and production-server separate. It is also quite safe for production, since you can review and optionally modify the migration before applying it.
While evaluating ORMs for .NET, I've tried Entity Framework 5 which - as I found out - has very similar functionality to the Django-South's one. There's a Package-Manager Console command for creating migration code which might be modified before executing, there's a separate command which executes all the not-yet-executed migrations, and marks them as executed in migration history.
Is there any tool like this for NHibernate?
I am aware of SchemaUpdate
functionality, but AFAIK it just updates all the things which need to be updated in one step. I wouldn't use that in production, neither during development where data loss is not a disaster but still some pain.
I am also aware SchemaUpdate might be used for exporting the SQL statements to a file instead of executing them, but it's not that convenient as there's no auto-management of history migration. Plus, one have to write SQL by hand ;)
Don't know if this really answers your question but to automate schema changes and update your mappings or even designing your mappings, it is a good idea to use tooling for that. Especially if you have a very big database/domain model.
I'm currently working with the entity developer from devart.
We compared multiple similar tools which are out there, but this one really rocks. It just has so many features and also provides the feature to add custom T4 templates to generate whatever you want out of your models and even add custom attributes to the model designer which then can be used within the code generator part...
You can also rename your entities/properties to something more readable manually and the tool will preserve this even after updates from the database schema...
And of course it supports both, model or database first approach...
You can download a trial version of cause to figure out if this would fit your needs...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With