Tags

,


UPDATE-DATABASE

Updates the database to the current model by applying pending migrations.

OPEN PACKAGE MANAGER CONSOLE in Visual Studio (TOOLS>Library Package Manager  > Package Manager Console)

SYNOPSIS

Applies any pending migrations to the database.

SYNTAX

    Update-Database

[-SourceMigration <String>]

[-TargetMigration <String>]

[-Script]

[-Force]

[-ProjectName <String>]

[-StartUpProjectName <String>]

[-ConfigurationTypeName <String>]

[-ConnectionStringName <String>]

[<CommonParameters>]

DESCRIPTION

Updates the database to the current model by applying pending migrations.

PARAMETERS

 

-SourceMigration <String>

Only valid with -Script. Specifies the name of a particular migration to use  as the update’s starting point. If ommitted, the last applied migration in  the database will be used.

        Required?                    false

        Position?                    named

        Default value

        Accept pipeline input?       false

        Accept wildcard characters?

    -TargetMigration <String>

Specifies the name of a particular migration to update the database to. If  ommitted, the current model will be used.

        Required?                    false

        Position?                    named

        Default value

        Accept pipeline input?       false

        Accept wildcard characters?

    -Script [<SwitchParameter>]

        Generate a SQL script rather than executing the pending changes directly.

        Required?                    false

        Position?                    named

        Default value

        Accept pipeline input?       false

        Accept wildcard characters?

    -Force [<SwitchParameter>]

Specifies that data loss is acceptable during automatic migration of the  database.

        Required?                    false

        Position?                    named

        Default value

        Accept pipeline input?       false

        Accept wildcard characters?

    -ProjectName <String>

Specifies the project that contains the migration configuration type to be used. If ommitted, the default project selected in package manager console is used.

        Required?                    false

        Position?                    named

        Default value

        Accept pipeline input?       false

        Accept wildcard characters?

    -StartUpProjectName <String>

Specifies the configuration file to use for named connection strings. If omitted, the specified project’s configuration file is used.

        Required?                    false

        Position?                    named

        Default value

        Accept pipeline input?       false

        Accept wildcard characters?

    -ConfigurationTypeName <String>

Specifies the migrations configuration to use. If omitted, migrations will attempt to locate a single migrations configuration type in the target project.

        Required?                    false

        Position?                    named

        Default value

        Accept pipeline input?       false

        Accept wildcard characters?

    -ConnectionStringName <String>

Specifies the name of a connection string to use from the application’s configuration file.

        Required?                    false

        Position?                    named

        Default value

        Accept pipeline input?       false

        Accept wildcard characters?

    -ConnectionString <String>

Specifies the the connection string to use. If omitted, the context’s default connection will be used.

        Required?                    true

        Position?                    named

        Default value

        Accept pipeline input?       false

        Accept wildcard characters?

    -ConnectionProviderName <String>

Specifies the provider invariant name of the connection string.

        Required?                    true

        Position?                    named

        Default value

        Accept pipeline input?       false

        Accept wildcard characters?

    <CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,  ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable.

 

Enjoy!!

 

Advertisements