SchemaUpdate不会删除表或删除列 [英] SchemaUpdate does not drop tables or delete columns

查看:152
本文介绍了SchemaUpdate不会删除表或删除列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SchemaUpdate根据一些配置对数据库进行更改。
当添加新的表或列时,它工作正常。
但是,当删除列或删除表时,它不起作用。
映射文件确实反映了这些更改,但SchemaUpdate似乎没有认识到这一点。
我不想丢弃表格并重新创建它们,因为我希望数据被保留。



有谁知道这个删除和删除SchemaUpdate支持的功能是什么?



谢谢 解决方案

不 - SchemaUpdate将只添加新的表/列。这种行为是通过设计的 - 您的模型可以(例如)映射到许多系统使用的数据库上,而且它只能使用表/列的子集。在这种情况下,如果SchemaUpdate确实删除了这些列和表,那么它将会破坏所有其他系统。



请参阅 NHibernate的SchemaUpdate 的替代品。


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.

这篇关于SchemaUpdate不会删除表或删除列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆