I've a situation with Two database projects in Visual STudio, the one is Tailspin.schema and the other is called TailspinSchemaAndTestData that references the first one and add some test data with a post deploy script.
If I deploy the first dacpac, no problem, but clearly I have no test data, if I deploy the Tailspin.SchemaAndTestDAta I got no error running Dsc-StartConfiguration, but the output shows a Dac Deploy Failed message
VERBOSE: [WEBTEST2]: LCM: [ Start Set ] [[xDatabase]DeployDacTestData]
VERBOSE: [WEBTEST2]: [[xDatabase]DeployDacTestData] Dac Deploy Failed
VERBOSE: [WEBTEST2]: LCM: [ End Set ] [[xDatabase]DeployDacTestData] in 7.1750 seconds.
VERBOSE: [WEBTEST2]: LCM: [ End Resource ] [[xDatabase]DeployDacTestData]
This is 99% due to dacpac not finding referenced dacpac in desired location (probably we need to use theIncludeCompositeObjects=true but I've not find a place where I can set detailed properties of dacpac deploy.
I think that it would be useful to add a property to xDatabase to specify additional paramters for dacpac deployment
Then I simply tried to specify both the dacpacs, one after the another.
xDatabase DeployDac
{
Ensure = "Present"
SqlServer = "."
SqlServerVersion = "2012"
DatabaseName = "TailspinToys"
Credentials = (New-Object System.Management.Automation.PSCredential("sa", (ConvertTo-SecureString "xxxx" -AsPlainText -Force)))
DacPacPath = $sourceFiles + "Tailspin.Schema.DacPac"
DacPacApplicationName = "Tailspin"
}
xDatabase DeployDacTestData
{
Ensure = "Present"
SqlServer = "."
SqlServerVersion = "2012"
DatabaseName = "TailspinToys"
Credentials = (New-Object System.Management.Automation.PSCredential("sa", (ConvertTo-SecureString "xxxx" -AsPlainText -Force)))
DacPacPath = $sourceFiles + "Tailspin.SchemaAndTestData.DacPac"
DacPacApplicationName = "TailspinTestData"
}
But when I try to call the configuration I got this error.
Add-NodeKeys : The key properties combination 'TailspinToys' is duplicated for keys 'DatabaseName' of resource 'xDatabase'
in node 'WebTest2'. Please make sure key properties are unique for each resource in a node.
It seems that I'm not able to specify multiple dacpac for the same database, it is a big limitation. Am I doing something wrong?
Gian Maria.
Ricci Gian Maria. (http://www.codewrecks.com)