Protection against cooking recipe a few times during installations ?

Topics: Installing Orchard
Apr 16, 2014 at 12:40 PM
We are trying to use Orchard with MSSQL DB. We've got installation scripts for Orchard. Using this scripts people install Orchard on a few PC-es using the same DB. If it is first installation then scripts should cook recipe. Problem is that recipe can't be cooked many times because in this case layers, menus and other elements are created multiple times. How can we protect against such problems ?
We done it creating in our module copy of SetupService.cs from Orchard.Setup module.
During installation we call 'Orchard recipe' for our class in which we verify if specific Orchard's table exist in DB and call cooking only when doesn't exist (first call).
Can it be done better ? Now if someone change something in mentioned Orchard's file (SetupService.cs) changes are not applied automatically in our changed file. Additionally code is not nice because database operations on Orchard's table appears in our additional module (schemaBuilder.ExecuteSql("SELECT * FROM " + tableName)).