RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade) Method

Definition

Applies any pending migrations for the context to the database. Will create the database if it does not already exist.

public static void Migrate (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Migrations operations are not supported with NativeAOT Use a migration bundle or an alternate way of executing migration operations.")]
public static void Migrate (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade);
static member Migrate : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade -> unit
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Migrations operations are not supported with NativeAOT Use a migration bundle or an alternate way of executing migration operations.")>]
static member Migrate : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade -> unit
<Extension()>
Public Sub Migrate (databaseFacade As DatabaseFacade)

Parameters

databaseFacade
DatabaseFacade

The DatabaseFacade for the context.

Attributes

Remarks

Note that this API is mutually exclusive with EnsureCreated(). EnsureCreated does not use migrations to create the database and therefore the database that is created cannot be later updated using migrations.

See Database migrations for more information and examples.

Applies to