xDatabase icon indicating copy to clipboard operation
xDatabase copied to clipboard

How to pass variables in post-deployment script

Open testlab9000 opened this issue 8 years ago • 1 comments

How can I pass a variable in the DACPAC post-deployment script with xDatabase? For example in the following post-deployment script: EXEC ('ALTER DATABASE [$(DatabaseName)] MODIFY FILE (NAME = [$(DatabaseName)], SIZE = 100MB, MAXSIZE = UNLIMITED, FILEGROWTH = 20%)');

I can pass $(DatabaseName) by referencing it in

        {
            Ensure = 'Present'
            SqlServer = 'localhost'
            SqlServerVersion = '2014'
            DatabaseName = $DatabaseName
            Credentials = $Credential
            DacPacPath =  'C:\DatabaseTest.dacpac'
            DacPacApplicationName =  $DatabaseName
            DacPacApplicationVersion =  '1.0'
        }

But how can I pass $(databaseSizeSQLCMD) in the following script? EXEC ('ALTER DATABASE [$(DatabaseName)] MODIFY FILE (NAME = [$(DatabaseName)], SIZE = $(databaseSizeSQLCMD), MAXSIZE = UNLIMITED, FILEGROWTH = 20%)');

testlab9000 avatar Mar 19 '17 18:03 testlab9000

It doesn't seem possible to run post-deployment scripts with the current implementation. Maybe new properties in the schema is needed to handle this.

johlju avatar May 02 '18 11:05 johlju