IMigrator.GenerateScript Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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)
- Source:
- IMigrator.cs
- Source:
- IMigrator.cs
- Source:
- IMigrator.cs
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);
public string GenerateScript (string? fromMigration = default, string? toMigration = default, Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions options = Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions.Default);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Migration generation currently isn't compatible with trimming")]
public string GenerateScript (string? fromMigration = default, string? toMigration = default, Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions options = Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions.Default);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Migration generation currently isn't compatible with trimming")]
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Migrations operations are not supported with NativeAOT")]
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
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Migration generation currently isn't compatible with trimming")>]
abstract member GenerateScript : string * string * Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerationOptions -> string
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Migration generation currently isn't compatible with trimming")>]
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Migrations operations are not supported with NativeAOT")>]
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
The generated script.
- Attributes
Remarks
See Database migrations for more information and examples.
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
The generated script.
Applies to
Entity Framework