SQL Release

New-DlmDatabasePackage

New-DlmDatabasePackage

Packages the validated database schema produced by the Invoke-DlmDatabaseSchemaValidation cmdlet.

Syntax

New-DlmDatabasePackage [-InputObject] <ValidatedSchemaSource> -PackageId <string> -PackageVersion <string> [-Documentation <SchemaDocumentation>] [<CommonParameters>]

Description

The New-DlmDatabasePackage cmdlet takes a validated schema source from the output of the Invoke-DlmDatabaseSchemaValidation cmdlet and creates a NuGet package containing that schema. It creates a DatabasePackage object that represents the NuGet package. It can also include the documentation for your database using the output of the New-DlmDatabaseDocumentation cmdlet.

You can use the Export-DlmDatabasePackage cmdlet to export the NuGet package to file.

Parameters

-InputObject <RedGate.SQLRelease.Compare.SchemaValidation.ValidatedSchemaSource>

The output object of Invoke-DlmDatabaseSchemaValidation cmdlet, which represents the validated database schema.

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

-PackageId <System.String>

The unique identifier for the package you are creating.

This mustn't contain more than 100 characters and must be a valid NuGet package identifier.

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

-PackageVersion <System.String>

The version of the package. This must be in a valid NuGet version format (eg 3.2.1, 3.2.1-beta1).

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

-Documentation <RedGate.SQLRelease.Compare.Documentation.SchemaDocumentation>

The documentation object created by New-DlmDatabaseDocumentation to include in the database package.

Aliases None
Required?false
Position?named
Default Value None
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.SQLRelease.Compare.SchemaValidation.ValidatedSchemaSource

    The output object of Invoke-DlmDatabaseSchemaValidation cmdlet, which represents the validated database schema.

Return values

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

  • RedGate.SQLRelease.Compare.Packaging.DatabasePackage

Examples

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

$scriptsFolder = "C:\Work\scripts"
$validatedSchema = $scriptsFolder | Invoke-DlmDatabaseSchemaValidation
$databasePackage = $validatedSchema | New-DlmDatabasePackage -PackageId MyDatabase -PackageVersion 1.0.0
$databasePackage | Export-DlmDatabasePackage -Path "c:\packages"

This example shows how to use the New-DlmDatabasePackage cmdlet to create a NuGet database package from a validated schema.

First the Invoke-DlmDatabaseSchemaValidation cmdlet validates the database schema. Then the New-DlmDatabasePackage cmdlet creates the package. Finally the Export-DlmDatabasePackage cmdlet exports the package to file.

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

$scriptsFolder = "C:\Work\scripts"
$validatedSchema = $scriptsFolder | Invoke-DlmDatabaseSchemaValidation
$documentation = $validatedSchema | New-DlmDatabaseDocumentation

$databasePackage = $validatedSchema | New-DlmDatabasePackage -PackageId MyDatabase -PackageVersion 1.0.0 -Documentation $documentation
$databasePackage | Export-DlmDatabasePackage -Path "c:\packages"

This example shows how to use the New-DlmDatabasePackage cmdlet to create a NuGet database package that also includes database documentation.

The documentation is created by the New-DlmDatabaseDocumentation cmdlet.


Didn't find what you were looking for?