Tags

,


ADD-MIGRATION

Scaffolds a new migration script and adds it to the project.

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

SYNOPSIS

Scaffolds a migration script for any pending model changes.

SYNTAX

Add-Migration

[-Name] <String>

[-Force]

[-ProjectName <String>]

[-StartUpProjectName <String>]

[-ConfigurationTypeName <String>]

[-ConnectionStringName <String>]

[-IgnoreChanges]

[<CommonParameters>]

DESCRIPTION

Scaffolds a new migration script and adds it to the project.

PARAMETERS

-Name <String>

Specifies the name of the custom script.

Required?                    true

Position?                    1

Default value

Accept pipeline input?       false

Accept wildcard characters?

    -Force [<SwitchParameter>]

Specifies that the migration user code be overwritten when re-scaffolding an  existing migration.

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?

    -IgnoreChanges [<SwitchParameter>]

Scaffolds an empty migration ignoring any pending changes detected in the current model. This can be used to create an initial, empty migration to enable Migrations for an existing database. N.B. Doing this assumes that the target database schema is compatible with the current model.

        Required?                    false

        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