NHibernate SchemaUpdate adding existing foreign keys again?
Posted
by
afsharm
on Stack Overflow
See other posts from Stack Overflow
or by afsharm
Published on 2010-10-28T07:13:21Z
Indexed on
2011/01/09
19:53 UTC
Read the original article
Hit count: 249
I'm using SchemaUpdate to synchronize my hbms with existing database. Database has recently created based on hbms and is completely up-to-date. But SchemaUpdate generates all foreign key constraints again.
For example suppose you have Student and Teacher. Student has association to Teacher with name ArtTeacher. ArtTeacher is a foreign key from Student to Teacher. Suppose database is up-to-date and currently holde Student, Teacher and their foreign key relation. So HBM and Database are equivalent. Know SchemaUpdate must not do anything but when I see its generated scripts, it re-produce that foreign key again.
Why this happens? Is there any way to avoid it?
© Stack Overflow or respective owner