Issue creating Tennant from script

Topics: Installing Orchard, Troubleshooting
Apr 23, 2013 at 7:42 AM
Hi, I have an issue running up a tennant from a script.

I have a number of Orchard instances that we setup using a powershell script for easily putting onto all our dev environments, and that has all been working fine. Now i'm trying to add a tennant in the setup process, and it gives me an error: "Invalid object name 'c_Setting_ShellDescriptorRecord'

It gets as far as enabling multitennancy and creating the tennant, but errors when trying to create the database tables with the prefix "c".

This bit works fine:
$orchardCreateCmd = "$websitePhysicalPath\bin\orchard.exe setup " + 
        "/SiteName:""$WEBSITE_TITLE"" " +
        "/AdminUsername:""$ADMIN_USERNAME"" " +
        "/AdminPassword:""$ADMIN_PASSWORD"" " +
        "/DatabaseProvider:""SQLServer"" " +
        "/DatabaseConnectionString:""Data Source=$DB_HOST;Initial Catalog=$DB_NAME;Integrated Security=True;MultipleActiveResultSets=True"" " + 
        "/Recipe:""$RECIPE_NAME"" ";
invoke-expression -command $orchardCreateCmd

$extCommandsEnableTennant = "$websitePhysicalPath\bin\orchard.exe feature enable Orchard.MultiTenancy";
invoke-expression -command $extCommandsEnableTennant

$extCommandsAddTennantA = "$websitePhysicalPath\bin\orchard.exe tenant add mytennant/Host:cms.mytennant.local";
invoke-expression -command $extCommandsAddTennantA
And it blows up on this:
$extCommandsTennantDbConfig = "$websitePhysicalPath\bin\orchard.exe setup " + 
    "/t:mytennant " +
        "/SiteName:""Testsite"" " +
    "/DatabaseTablePrefix:""c"" " +
        "/AdminUsername:""$ADMIN_USERNAME"" " +
        "/AdminPassword:""$ADMIN_PASSWORD"" " +
        "/DatabaseProvider:""SQLServer"" " +
        "/DatabaseConnectionString:""Data Source=$DB_HOST;Initial Catalog=$DB_NAME;Integrated Security=True;MultipleActiveResultSets=True"" ";
invoke-expression -command $extCommandsTennantDbConfig
with the "Invalid object name 'c_Setting_ShellDescriptorRecord' error.

I get the same error from orchard admin if i go in and add a tennant and choose "allow the tennant to setup the database", and when i then click "set up" and select "use an existing sql server", paste in the valid connection string. It starts cooking the recipe, but blows up with the same error.

But, if i go in and add a tennant and choose "use an existing sql server", and paste in the same connection string, and then click "set up", I doesn't ask me on the next screen "How would you like to store your data?", and the setup works fine & the tennant is created successfully.

So basically, is there a flag/switch i'm missing in my powershell script that tells it to use the existing DB, or what have i done incorrectly?

Many thanks for any ideas,
Ian
Apr 24, 2013 at 1:56 AM
Edited Apr 24, 2013 at 1:57 AM
I get the same error if I run the setup from the orchard command line, so it's not powershell related. Might it be something with database permissions?
setup /t:mytennant /SiteName:TestTenant /DatabaseTablePrefix:c /AdminUsername:admin /AdminPassword:password  /DatabaseProvider:SQLServer /DatabaseConnectionString:"Data Source=localhost;Initial Catalog=CMS_DB;Persist Security Info=True;Integrated Security=True"
Coordinator
Apr 24, 2013 at 2:51 AM
Please file a bug.