Module self-detection of pending upgrade

Topics: Customizing Orchard, Writing modules
Jan 30, 2012 at 8:36 PM

Is it possible for a module to detect if it currently requires an update and either prevent execution, or otherwise avoid an exception or unwanted side effects of running a module against an outdated schema?

Backstory:

I just came slightly unstuck, I am in the process of building out a module that injects a peice of 3rd party analytics code into every single page except for /admin. In the process of coding I realised a "DebugMode" would be helpful and added this to the SettingsPart and associated Record, Migrations and Editor Views, rebuilt the project hit the site in the browser.

You guessed it SqlException, could not load property DebugMode. Fairly easy to fix I think, went to /admin, get redirected to /Users/Account/AccessDenied?ReturnUrl=%2fadmin which also throws an exception. Faily trivial fix for me with code access, would be great news if there was a better way. I tried catching SqlException from the code but this seemed to have no effect.

Coordinator
Jan 30, 2012 at 8:48 PM

With 1.4 migrations will happen automatically before executing the module. So those issues should not happen again.

Jan 31, 2012 at 6:51 PM

Excellent, 1.4 is much anticipated.