Search Results for

    Show / Hide Table of Contents

    Class NpgsqlMigrationsSqlGenerator

    PostgreSQL-specific implementation of .

    Inheritance
    object
    NpgsqlMigrationsSqlGenerator
    Namespace: Npgsql.EntityFrameworkCore.PostgreSQL.Migrations
    Assembly: Npgsql.EntityFrameworkCore.PostgreSQL.dll
    Syntax
    public class NpgsqlMigrationsSqlGenerator : MigrationsSqlGenerator
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    Constructors

    | Improve this Doc View Source

    NpgsqlMigrationsSqlGenerator(MigrationsSqlGeneratorDependencies, INpgsqlSingletonOptions)

    Creates a new NpgsqlMigrationsSqlGenerator instance.

    Declaration
    public NpgsqlMigrationsSqlGenerator(MigrationsSqlGeneratorDependencies dependencies, INpgsqlSingletonOptions npgsqlSingletonOptions)
    Parameters
    Type Name Description
    MigrationsSqlGeneratorDependencies dependencies

    Parameter object containing dependencies for this service.

    INpgsqlSingletonOptions npgsqlSingletonOptions

    The singleton options to use.

    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    Methods

    | Improve this Doc View Source

    ApplyTsVectorColumnSql(ColumnOperation, IModel?, string, string?, string)

    Checks for a TsVectorConfig annotation on the given column, and if found, assigns the appropriate SQL to .

    Declaration
    protected virtual void ApplyTsVectorColumnSql(ColumnOperation column, IModel? model, string name, string? schema, string table)
    Parameters
    Type Name Description
    ColumnOperation column
    IModel? model
    string name
    string? schema
    string table
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    ColumnDefinition(string?, string, string, ColumnOperation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected override void ColumnDefinition(string? schema, string table, string name, ColumnOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    string? schema
    string table
    string name
    ColumnOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    ComputedColumnDefinition(string?, string, string, ColumnOperation, IModel?, MigrationCommandListBuilder)

    Generates a SQL fragment for a computed column definition for the given column metadata.

    Declaration
    protected override void ComputedColumnDefinition(string? schema, string table, string name, ColumnOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    string? schema

    The schema that contains the table, or null to use the default schema.

    string table

    The table that contains the column.

    string name

    The column name.

    ColumnOperation operation

    The column metadata.

    IModel? model

    The target model which may be null if the operations exist without a model.

    MigrationCommandListBuilder builder

    The command builder to use to add the SQL fragment.

    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(AddColumnOperation, IModel?, MigrationCommandListBuilder, bool)

    Declaration
    protected override void Generate(AddColumnOperation operation, IModel? model, MigrationCommandListBuilder builder, bool terminate = true)
    Parameters
    Type Name Description
    AddColumnOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    bool terminate
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(AlterColumnOperation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected override void Generate(AlterColumnOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    AlterColumnOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(AlterDatabaseOperation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected override void Generate(AlterDatabaseOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    AlterDatabaseOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(AlterTableOperation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected override void Generate(AlterTableOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    AlterTableOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(CreateIndexOperation, IModel?, MigrationCommandListBuilder, bool)

    Declaration
    protected override void Generate(CreateIndexOperation operation, IModel? model, MigrationCommandListBuilder builder, bool terminate = true)
    Parameters
    Type Name Description
    CreateIndexOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    bool terminate
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(CreateSequenceOperation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected override void Generate(CreateSequenceOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    CreateSequenceOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(CreateTableOperation, IModel?, MigrationCommandListBuilder, bool)

    Declaration
    protected override void Generate(CreateTableOperation operation, IModel? model, MigrationCommandListBuilder builder, bool terminate = true)
    Parameters
    Type Name Description
    CreateTableOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    bool terminate
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(DropColumnOperation, IModel?, MigrationCommandListBuilder, bool)

    Declaration
    protected override void Generate(DropColumnOperation operation, IModel? model, MigrationCommandListBuilder builder, bool terminate = true)
    Parameters
    Type Name Description
    DropColumnOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    bool terminate
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(DropIndexOperation, IModel?, MigrationCommandListBuilder, bool)

    Declaration
    protected override void Generate(DropIndexOperation operation, IModel? model, MigrationCommandListBuilder builder, bool terminate = true)
    Parameters
    Type Name Description
    DropIndexOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    bool terminate
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(EnsureSchemaOperation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected override void Generate(EnsureSchemaOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    EnsureSchemaOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(InsertDataOperation, IModel?, MigrationCommandListBuilder, bool)

    Builds commands for the given by making calls on the given , and then terminates the final command.

    Declaration
    protected override void Generate(InsertDataOperation operation, IModel? model, MigrationCommandListBuilder builder, bool terminate = true)
    Parameters
    Type Name Description
    InsertDataOperation operation

    The operation.

    IModel? model

    The target model which may be null if the operations exist without a model.

    MigrationCommandListBuilder builder

    The command builder to use to build the commands.

    bool terminate

    Indicates whether or not to terminate the command after generating SQL for the operation.

    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(IReadOnlyList<MigrationOperation>, IModel?, MigrationsSqlGenerationOptions)

    Declaration
    public override IReadOnlyList<MigrationCommand> Generate(IReadOnlyList<MigrationOperation> operations, IModel? model = null, MigrationsSqlGenerationOptions options = null)
    Parameters
    Type Name Description
    IReadOnlyList<><MigrationOperation> operations
    IModel? model
    MigrationsSqlGenerationOptions options
    Returns
    Type Description
    IReadOnlyList<><MigrationCommand>
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(MigrationOperation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected override void Generate(MigrationOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    MigrationOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(NpgsqlCreateDatabaseOperation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected virtual void Generate(NpgsqlCreateDatabaseOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    NpgsqlCreateDatabaseOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(NpgsqlDropDatabaseOperation, IModel?, MigrationCommandListBuilder)

    Declaration
    public virtual void Generate(NpgsqlDropDatabaseOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    NpgsqlDropDatabaseOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(RenameColumnOperation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected override void Generate(RenameColumnOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    RenameColumnOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(RenameIndexOperation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected override void Generate(RenameIndexOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    RenameIndexOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(RenameSequenceOperation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected override void Generate(RenameSequenceOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    RenameSequenceOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Generate(RenameTableOperation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected override void Generate(RenameTableOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    RenameTableOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    GenerateAddEnumLabel(PostgresEnum, string, string?, IModel?, MigrationCommandListBuilder)

    Declaration
    protected virtual void GenerateAddEnumLabel(PostgresEnum enumType, string addedLabel, string? beforeLabel, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    PostgresEnum enumType
    string addedLabel
    string? beforeLabel
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    GenerateCollationStatements(AlterDatabaseOperation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected virtual void GenerateCollationStatements(AlterDatabaseOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    AlterDatabaseOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    GenerateCreateCollation(PostgresCollation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected virtual void GenerateCreateCollation(PostgresCollation collation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    PostgresCollation collation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    GenerateCreateEnum(PostgresEnum, IModel?, MigrationCommandListBuilder)

    Declaration
    protected virtual void GenerateCreateEnum(PostgresEnum enumType, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    PostgresEnum enumType
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    GenerateCreateExtension(PostgresExtension, IModel?, MigrationCommandListBuilder)

    Declaration
    protected virtual void GenerateCreateExtension(PostgresExtension extension, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    PostgresExtension extension
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    GenerateCreateRange(PostgresRange, IModel?, MigrationCommandListBuilder)

    Declaration
    protected virtual void GenerateCreateRange(PostgresRange rangeType, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    PostgresRange rangeType
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    GenerateDropCollation(PostgresCollation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected virtual void GenerateDropCollation(PostgresCollation collation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    PostgresCollation collation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    GenerateDropEnum(PostgresEnum, IModel?, MigrationCommandListBuilder)

    Declaration
    protected virtual void GenerateDropEnum(PostgresEnum enumType, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    PostgresEnum enumType
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    GenerateDropRange(PostgresRange, IModel?, MigrationCommandListBuilder)

    Declaration
    protected virtual void GenerateDropRange(PostgresRange rangeType, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    PostgresRange rangeType
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    GenerateEnumStatements(AlterDatabaseOperation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected virtual void GenerateEnumStatements(AlterDatabaseOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    AlterDatabaseOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    GenerateRangeStatements(AlterDatabaseOperation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected virtual void GenerateRangeStatements(AlterDatabaseOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    AlterDatabaseOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    IdentityDefinition(ColumnOperation, MigrationCommandListBuilder)

    Declaration
    protected virtual void IdentityDefinition(ColumnOperation operation, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    ColumnOperation operation
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    IndexOptions(CreateIndexOperation, IModel?, MigrationCommandListBuilder)

    Declaration
    protected override void IndexOptions(CreateIndexOperation operation, IModel? model, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    CreateIndexOperation operation
    IModel? model
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    RecreateIndexes(IColumn?, MigrationOperation, MigrationCommandListBuilder)

    Declaration
    protected virtual void RecreateIndexes(IColumn? column, MigrationOperation currentOperation, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    IColumn? column
    MigrationOperation currentOperation
    MigrationCommandListBuilder builder
    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Rename(string?, string, string, string, MigrationCommandListBuilder)

    Renames a database object such as a table, index, or sequence.

    Declaration
    public virtual void Rename(string? schema, string name, string newName, string type, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    string? schema

    The current schema of the object to rename.

    string name

    The current name of the object to rename.

    string newName

    The new name.

    string type

    The type of the object (e.g. TABLE, INDEX, SEQUENCE).

    MigrationCommandListBuilder builder

    The builder to which operations are appended.

    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    | Improve this Doc View Source

    Transfer(string, string?, string, string, MigrationCommandListBuilder)

    Transfers a database object such as a table, index, or sequence between schemas.

    Declaration
    public virtual void Transfer(string newSchema, string? schema, string name, string type, MigrationCommandListBuilder builder)
    Parameters
    Type Name Description
    string newSchema

    The new schema.

    string? schema

    The current schema.

    string name

    The name of the object to transfer.

    string type

    The type of the object (e.g. TABLE, INDEX, SEQUENCE).

    MigrationCommandListBuilder builder

    The builder to which operations are appended.

    Remarks

    The service lifetime is . This means that each instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

    See Database migrations.

    • Improve this Doc
    • View Source
    In This Article
    Back to top © Copyright 2023 The Npgsql Development Team