Wednesday, August 26, 2009

NHibernate Schema Export Frustrations!

NHibernate makes schema creation quick and easy, but one situation I found annoying was that calling new SchemaExport().Execute() wouldn't drop the existing schema first. I found myself manually deleting the tables in the database in the correct sequence every time I wanted to blow away the schema and rebuild it.

Error


Through some Googling, I discovered that if you split the SchemaExport into multiple calls, you no longer receive the issue.

Before


After


It seems as though the Drop method doesn't have an issue on a fresh database, yet drops the database elements of they already exist.

No comments:

Post a Comment