This project is read-only.

Removing Record Properties, Migration and NHibernate mappings.bin

Topics: Writing modules
Aug 31, 2012 at 2:43 PM

Hi Folks,

I came across an interesting problem today with Orchard and the migrations.cs file. Perhaps the core team could comment.

I previously deployed a module with a contentpart/record with one property "ConfigurationId". Several Items were created with this Id and all was well.

I changed the definition of the record for the part, to add several new properties and remove the "ConfigurationId" property. I updated the Record, Part, Driver, Edit and Diplay Veews, and also added a new method to the migrations file to add the new DB columns and remove the old one. On re-running the site, I expected that the migration would be run before much else happened, however, Orchard crashed out with a complaint that the mapping for "ConfigurationId" could not be found. After reviewing this post i deleted my mappings.bin file and things started working again. The next time I F5'd the solution, the migrations.cs method was called as expected.

Mostly I am curious - should the migrations not occur before any attempt to map individual objects? Otherwise it seems extremely easy to bring down a site with the module already active, even when you give a specific migration route...

Sep 13, 2012 at 12:03 AM

Not sure what you mean by "it seems extremely easy to bring down a site" but yes, there may be an issue there in that a site can crash before the migration has a chance to run with some model changes. Not sure how to fix it but please file a bug.

Sep 13, 2012 at 9:14 AM

I'll see if I can get some reproduction steps.

Sep 13, 2012 at 10:13 AM
LordSaul wrote:

I'll see if I can get some reproduction steps.

If you report it, post the link here : I also regulary have to remove the mappings bin file while developing.