DLM Automation

Export-DlmDatabaseRelease

Export-DlmDatabaseRelease

Exports database deployment resources, which are produced by the New-DlmDatabaseRelease cmdlet to a folder or .zip file on disk.

Syntax

Export-DlmDatabaseRelease [-InputObject] <DatabaseRelease> -Path <Object> [-Format <OutputFormat>] [-Force] [<CommonParameters>]

Description

The Export-DlmDatabaseRelease cmdlet exports database deployment resources, which are produced by the New-DlmDatabaseRelease cmdlet to a folder or .zip file. The folder of .zip file contains the following resources:

- 'Update.sql': The SQL update script containing all the changes that will be made when Use-DlmDatabaseRelease is run with this DatabaseRelease object.

- 'Changes.html': Lists the database objects that will change as a result of running the 'Update.sql' script, and highlights SQL code differences for each object before and after the update. This report also includes changes to static data, shows warnings of any potential data loss and the SQL update script that will be run.

- 'Warnings.xml': Lists any warnings related to running the 'Update.sql' script.

- 'States/': Contains a representation of the state of each database before running the update and the desired state after the update.

- 'RedGateUpdateMetadata.xml': Contains metadata about the database deployment resources and the SQL Compare options used in comparisons.

- 'Filter.scpf': If SQL Compare filters are used when creating the database deployment resources, they are saved in this file.

Specify the output folder or file using the Path parameter. If the Path ends in .zip, the database deployment resources will be exported to a .zip file. Otherwise, they'll be exported to a folder. You can override this choice with the optional Format parameter.

Parameters

-InputObject <RedGate.DLMAutomation.Compare.Domain.DatabaseRelease>

The DatabaseRelease object to be exported.

Aliases None
Required?true
Position?0
Default Value None
Accept Pipeline Inputtrue (ByValue)
Accept Wildcard Charactersfalse

-Path <System.Object>

The path to the output folder or .zip file. If the path ends in ".zip", the Database Release is exported to a zip file. Otherwise it is exported to a folder. You can override this automatic choice using the Format parameter, and setting it to either "Zip" or "Folder" as required.

Aliases None
Required?true
Position?named
Default Value None
Accept Pipeline Inputfalse
Accept Wildcard Charactersfalse

-Format <RedGate.DLMAutomation.Compare.Import.OutputFormat>

The output format of the Database Release. If you specify Zip, the Database Release will be exported to a .zip file. If you specify Folder, the Database Release will be exported to a folder. If you specify Default or don't use the parameter, the output format will be determined by the Path parameter.

Possible values: Default, Folder, Zip

Aliases None
Required?false
Position?named
Default ValueDefault
Accept Pipeline Inputfalse
Accept Wildcard Charactersfalse

-Force <System.Management.Automation.SwitchParameter>

Indicates that any existing output file or folder should be overwritten.

Aliases None
Required?false
Position?named
Default ValueFalse
Accept Pipeline Inputfalse
Accept Wildcard Charactersfalse

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see http://technet.microsoft.com/en-us/library/hh847884.aspx.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • RedGate.DLMAutomation.Compare.Domain.DatabaseRelease

    The DatabaseRelease object to be exported.

Return values

The output type is the type of the objects that the cmdlet emits.

  • None

Examples

---------- EXAMPLE 1 ----------

$staging = New-DlmDatabaseConnection -ServerInstance "staging01\sql2014" -Database "Staging"
$scriptsFolder = 'C:\Work\scripts'

$release = New-DlmDatabaseRelease -Source $scriptsFolder -Target $staging 
$release | Export-DlmDatabaseRelease -Path "C:\Export\"

This example shows how to create database deployment resources and export them to a folder.

The New-DlmDatabaseRelease cmdlet creates a DatabaseRelease object, which represents the database deployment resources. This object can update the database, Staging, to match the schema in the scripts folder C:\Work\scripts. The DatabaseRelease object is passed through the pipeline to the Export-DlmDatabaseRelease cmdlet. This cmdlet exports the database deployment resources to the folder C:\Export. The resources are exported to a folder because the Path parameter didn't end in .zip.

Exporting database deployment resources lets you review the update script and other update resources, such as the change report and deployment warnings.

---------- EXAMPLE 2 ----------

$staging = New-DlmDatabaseConnection -ServerInstance "staging01\sql2014" -Database "Staging"
$scriptsFolder = 'C:\Work\scripts'

New-DlmDatabaseRelease -Source $scriptsFolder -Target $staging | Export-DlmDatabaseRelease -Path "C:\Export.zip"

This example shows how to create a database deployment resources and export it to a .zip file.

The New-DlmDatabaseRelease cmdlet creates a DatabaseRelease object, representing the database deployment resources, which is passed through the pipeline to the Export-DlmDatabaseRelease cmdlet. This cmdlet exports the database deployment resources to a .zip file, because the Path parameter ended in .zip.

---------- EXAMPLE 3 ----------

$staging = New-DlmDatabaseConnection -ServerInstance "staging01\sql2014" -Database "Staging"
$scriptsFolder = "C:\Work\scripts"

New-DlmDatabaseRelease -Source $scriptsFolder -Target $staging | Export-DlmDatabaseRelease -Path "C:\Export" -Format Zip

This example shows how to create database deployment resources and export them to a .zip file using the Format parameter.

The Export-DlmDatabaseRelease cmdlet exports the database deployment resources to the .zip file, "C:\Export.zip" because "Zip" is specified by the Format parameter. If the Format parameter wasn't used, the database deployment resources would be exported to a folder, because the Path parameter doesn't end in ".zip".


Didn't find what you were looking for?