What triggers the Orchard Migration.cs to run when deploying to Azure?

419 Views Asked by At

I have a project I inherited that is built as a module of the Orchard CMS. I should point out I am not an expert in Orchard or ASP.NET programming. I am a desktop applications guy. My web skills are just strong enough to be a danger to myself and others. :-)

During development, we have added several new fields to our schema using the UpdateFromXX() methodology in the Migrations.cs. If I rollback my Azure database and run Orchard from my development environment (VS2017) I can set a breakpoint in my UpdateFromXX() method and prove the code is executed and creates my new fields in my database correctly.

However, if I rollback my database and deploy my Orchard site into Azure (without running it from my dev environment), the Migrations.cs does not appear to run, and so any new code I have that interacts with the new db fields will fail because those fields are missing in the database.

What is the correct way to cause Orchard to execute/re-execute the Migrations.cs logic when deployed in Azure? My intention is simply that when we have finished development and testing and are ready to roll-out our updates to our production server, that I can simply publish the new site and my production DB will be upgraded automatically (because the newly published orchard will fall through the Migrations.cs and do whatever UpdateFromXX() methods are necessary).

1

There are 1 best solutions below

1
Amor On

Please check the Orchard_Framework_DataMigrationRecord record for your module. You will find whether it shows the right version for your module. If the version number less than the XX in your UpdateFromXX method, the UpdateFromXX method will be executed. In addition, please also check whether disable and enable your module could solve your issue.