SchemaUpdate不会删除表或删除列

编程入门 行业动态 更新时间:2024-10-26 06:34:34
本文介绍了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不会删除表或删除列

本文发布于:2023-10-17 02:56:37,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:或删除   SchemaUpdate

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!