SQL Change Automation 3

Export-DatabaseReleaseArtifact

Export-DatabaseReleaseArtifact

Exports a Release Artifact produced by the New-DatabaseReleaseArtifact cmdlet to a folder or .zip file on disk.

Syntax

Export-DatabaseReleaseArtifact [-InputObject] <IReleaseArtifact> -Path <Object> [-Format <OutputFormat>] [-Force] [<CommonParameters>]

Description

The Export-DatabaseReleaseArtifact cmdlet exports database deployment resources, which are produced by the New-DatabaseReleaseArtifact cmdlet to a folder or .zip 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.Versioning.Automation.Compare.Domain.ReleaseArtifacts.IReleaseArtifact>

The IReleaseArtifact object to be exported.

Aliases None
Required? true
Position? 0
Default Value None
Accept Pipeline Input true (ByValue)
Accept Wildcard Characters false

-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 Input false
Accept Wildcard Characters false

-Format <RedGate.Versioning.Automation.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 Value Default
Accept Pipeline Input false
Accept Wildcard Characters false

-Force <System.Management.Automation.SwitchParameter>

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

Aliases None
Required? false
Position? named
Default Value False
Accept Pipeline Input false
Accept Wildcard Characters false

<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.Versioning.Automation.Compare.Domain.ReleaseArtifacts.IReleaseArtifact

    The IReleaseArtifact object to be exported.

Return values

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

  • None

Examples

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

$production = New-DatabaseConnection -ServerInstance "prod01\sql2014" -Database "Production"
$build = Import-DatabaseBuildArtifact "C:\Work\buildArtifacts\DatabaseBuildArtifact.1.0.0.nupkg"

$release = New-DatabaseReleaseArtifact -Source $build -Target $production
$release | Export-DatabaseReleaseArtifact -Path "C:\Export\DatabaseRelease"

This example shows how to create a SQL Change Automation Release Artifact and export it to a folder.

The New-DatabaseReleaseArtifact cmdlet creates a IReleaseArtifact object, which represents the database deployment resources. This object can update the database, Production. The IReleaseArtifact object is passed through the pipeline to the Export-DatabaseReleaseArtifact cmdlet. This cmdlet exports the database deployment resources to the folder C:\Export\DatabaseRelease\. 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 ----------

$production = New-DatabaseConnection -ServerInstance "prod01\sql2014" -Database "Production"
$build = Import-DatabaseBuildArtifact "C:\Work\buildArtifacts\DatabaseBuildArtifact.1.0.0.nupkg"

$release = New-DatabaseReleaseArtifact -Source $build -Target $production
$release | Export-DatabaseReleaseArtifact -Path "C:\Export\DatabaseRelease.zip"

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

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

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

$production = New-DatabaseConnection -ServerInstance "prod01\sql2014" -Database "Production"
$build = Import-DatabaseBuildArtifact "C:\Work\buildArtifacts\DatabaseBuildArtifact.1.0.0.nupkg"

$release = New-DatabaseReleaseArtifact -Source $build -Target $production
$release | Export-DatabaseReleaseArtifact -Path "C:\Export\DatabaseRelease" -Format Zip

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

The Export-DatabaseReleaseArtifact cmdlet exports the database deployment resources to the .zip file, "C:\Export\DatabaseRelease.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?