IMigrator.GenerateScript Method

Definition

Overloads

GenerateScript(String, String, MigrationsSqlGenerationOptions)

Generates a SQL script to migrate a database either in its entirety, or starting and ending at specified migrations.

GenerateScript(String, String, Boolean)

Generates a SQL script to migrate a database either in its entirety, or starting and ending at specified migrations.

GenerateScript(String, String, MigrationsSqlGenerationOptions)

Generates a SQL script to migrate a database either in its entirety, or starting and ending at specified migrations.

public string GenerateScript (string fromMigration = default, string toMigration = default, Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions options = Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions.Default);
abstract member GenerateScript : string * string * Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions -> string
Public Function GenerateScript (Optional fromMigration As String = Nothing, Optional toMigration As String = Nothing, Optional options As MigrationsSqlGenerationOptions = Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions.Default) As String

Parameters

fromMigration
String

The migration to start from, or null to start from the empty database.

toMigration
String

The target migration to migrate the database to, or null to migrate to the latest.

options
MigrationsSqlGenerationOptions

The options to use when generating SQL for migrations.

Returns

String

The generated script.

Applies to

GenerateScript(String, String, Boolean)

Generates a SQL script to migrate a database either in its entirety, or starting and ending at specified migrations.

public string GenerateScript (string fromMigration = default, string toMigration = default, bool idempotent = false);
abstract member GenerateScript : string * string * bool -> string
Public Function GenerateScript (Optional fromMigration As String = Nothing, Optional toMigration As String = Nothing, Optional idempotent As Boolean = false) As String

Parameters

fromMigration
String

The migration to start from, or null to start from the empty database.

toMigration
String

The target migration to migrate the database to, or null to migrate to the latest.

idempotent
Boolean

If true, then idempotent scripts will be generated, otherwise scripts will be generated that assume none of the migrations in the range specified have already been applied to the database.

Returns

String

The generated script.

Applies to