DatabaseDeploy
The DatabaseDeploy utility is used to create a new database or to update an existing database to the latest version.
You can also run the utility in a batch of commands. If the database creation/upgrade is successful, the return code returns 0, if it fails, it returns 1.
Command line syntax
DatabaseDeploy.exe /conn*<connection string>/langid<language id>*
Parameters
Parameter | Description |
---|---|
/conn <chain> | The connection string to the database. Note: the database name is also set in the connection string. |
/langid <language id> | ID of the database language. Supported values:
Note: this parameter is only applied when creating a new database. |
/collation | Collation of the new database, if not specified, will use the default collation of the database server. |
/multitenant | Connect to the tenant database and deploy all the databases or create a new empty tenant database. See Multitenant mode. |
- You can also set command line parameters in the appsettings.json file. The command line parameters take precedence over the settings in the configuration file.
- The utility expects the Alvao database definition file AlvaoDatabase.dacpac to exist in the same folder.
Examples
- Create a new Czech database named "ALVAO" on a local computer with SQL Server with instance name "sqlexpress" using integrated Windows authentication:
DatabaseDeploy.exe /conn "Data Source=.\sqlexpress;Initial Catalog=ALVAO; Integrated Security=True;TrustServerCertificate=True" /langid 1029
- Upgrade database named "ALVAO" to SQL server on server "SERVER1" using SQL username and password:
DatabaseDeploy.exe /conn "Data Source=SERVER1,1433;Initial Catalog=ALVAO;User ID=user1234;Password=secret1234;TrustServerCertificate=True"
- Upgrade all databases in a multitenant environment:
DatabaseDeploy.exe /conn "Data Source=.\sqlexpress;Initial Catalog=AlvaoTenants;Integrated Security=True;TrustServerCertificate=True" /multitenant
For more connection string examples, see Connection String Examples.