This project is read-only.

When does the migration code run?

Oct 20, 2010 at 8:34 AM
Edited Oct 20, 2010 at 8:34 AM

The documentation says that the migration runs when the feature is activated. I wanted to try this and disabled a feature then removed it's table from the database. Then after I Enabled the feature again it was not created again. The Create() method isn't even hit in the debugger. So I'm wondering does it only run the first time that the feature is enabled? How can I make it create the missing table again?


Oct 20, 2010 at 4:19 PM
Edited Oct 20, 2010 at 4:20 PM

It's run during the first time it is enabled, which can be during the original setup, or when you click on Enable. Then, whenever a change is detected in the migration classes, if a new upgrade mehtod is available, you are warn in the admin, and can launch the new updates.


Oct 20, 2010 at 7:32 PM

Thanks for the reply Sebastien. I noticed that even after I manually removed the database table for this feature (Orchard.Media), the feature is not failing, because it is not using the table at all. The table is Orchard_Media_MediaSettingsRecord. So why is the table created at all? I see there are similar tables defined (mostly like settings records) which logically will get at most one row of data site-wide. Is this for consistency purposes, or will they actually get multiple entries in a multi-tenant scenario?

My second question is: Is there any way to re-initialize the module to Create the table again from the browser (like reinstalling the module)?




Oct 20, 2010 at 7:39 PM

Good catch, we have removed the record in the project, but I forgot to remove the table. I will correct it.

Oct 20, 2010 at 7:42 PM

I have already removed it. You must have used an old dev snapshot. Currently old means more than one day old ;)