I am using SchemaUpdate to make changes to the database based on some configuration. It works fine when new tables or columns are added. However, it does not work when columns are deleted or tables are dropped. The mapping file does reflect these changes, but the SchemaUpdate does not seem to recognize this. I don't want to drop the tables and recreate them, as I want the data to be retained.
Does anyone know if this 'Delete and Drop' functionality is supported by SchemaUpdate?
Thanks
It is not - SchemaUpdate will only add new tables/columns. This behavior is by design - your model can (for example) be mapped on a database that is used by many systems, and it could only use a subset of tables/columns. In that case, if SchemaUpdate did drop those columns and tables - it would break all those other systems.
See NHibernate SchemaUpdate for alternatives.
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