Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change logical and physical file name when deploying dacpac

When deploying a dacpac for the first time using SqlPackage.exe how do I control the logical and physical file names for the new database.

The standard SQL statement would be:

CREATE DATABASE Bar
ON PRIMARY (NAME = 'Foo', FILENAME = '...\Foo\Foo.mdf')
LOG ON (NAME = 'Foo_log', FILENAME = '...\Foo\Foo.ldf')
like image 729
Chris Chilvers Avatar asked Oct 31 '22 01:10

Chris Chilvers


1 Answers

It seems this is not possible out of the box with the current tools. The variables $(DefaultFilePath) and $(DefaultLogPath) control the location but cannot be changed from the command line.

These values can be changed by using a custom deployment contributor, see Overriding DefaultDataPath and DefaultLogPath variables when using SqlPackage to publishing a dacpac.

like image 191
Chris Chilvers Avatar answered Nov 13 '22 04:11

Chris Chilvers