Search Results for

    Show / Hide Table of Contents

    Class PostgresExtensions

    Feature extensions for PostgreSQL

    Inheritance
    object
    PostgresExtensions
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: FluentMigrator.Postgres
    Assembly: FluentMigrator.Extensions.Postgres.dll
    Syntax
    public static class PostgresExtensions
    Remarks

    Given: MigrationBase m = null;

    These are valid calls:
    m.Alter.Column("").OnTable("").AsInt16().AddIdentity(PostgresGenerationType.Always);
    m.Alter.Column("").OnTable("").AsInt16().SetIdentity(PostgresGenerationType.Always);
    m.Alter.Column("").OnTable("").AsInt16().DropIdentity(true);
    m.Alter.Column("").OnTable("").AsInt16().Identity();
    m.Alter.Column("").OnTable("").AsInt16().Identity(PostgresGenerationType.Always);  //Ideally would like to stop this, forcing use of AddIdentity instead, but can't
    m.Alter.Table("").AddColumn("").AsInt16().Identity(PostgresGenerationType.Always);
    m.Alter.Table("").AlterColumn("").AsInt16().Identity(PostgresGenerationType.Always);
    
    These are not possible:
    m.Alter.Table("").AddColumn("").AsInt16().AddIdentity(PostgresGenerationType.Always);
    m.Alter.Table("").AddColumn("").AsInt16().SetIdentity(PostgresGenerationType.Always);
    m.Alter.Table("").AddColumn("").AsInt16().DropIdentity(PostgresGenerationType.Always);
    m.Alter.Table("").AlterColumn("").AsInt16().AddIdentity(PostgresGenerationType.Always);  //Ideally would like to have these 3, but can't distinguish between return type AddColumn and AlterColumn at compiletime
    m.Alter.Table("").AlterColumn("").AsInt16().SetIdentity(PostgresGenerationType.Always);
    m.Alter.Table("").AlterColumn("").AsInt16().DropIdentity(false);
    

    Fields

    | Edit this page View Source

    Concurrently

    Declaration
    public const string Concurrently = "PostgresConcurrently"
    Field Value
    Type Description
    string
    | Edit this page View Source

    IncludesList

    Declaration
    public const string IncludesList = "PostgresIncludes"
    Field Value
    Type Description
    string
    | Edit this page View Source

    IndexAlgorithm

    Declaration
    public const string IndexAlgorithm = "PostgresIndexAlgorithm"
    Field Value
    Type Description
    string
    | Edit this page View Source

    IndexFilter

    Declaration
    public const string IndexFilter = "PostgresIndexFilter"
    Field Value
    Type Description
    string
    | Edit this page View Source

    Only

    Declaration
    public const string Only = "PostgresOnly"
    Field Value
    Type Description
    string

    Properties

    | Edit this page View Source

    IdentityGeneration

    Column identity generation ability for PostgreSQL 10 and above

    Declaration
    public static string IdentityGeneration { get; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    IdentityModificationType

    Column identity modification type for PostgreSQL 10 and above

    Declaration
    public static string IdentityModificationType { get; }
    Property Value
    Type Description
    string

    Methods

    | Edit this page View Source

    AddIdentity(IAlterColumnOptionSyntax, PostgresGenerationType)

    Adds a generated identity to the column

    Declaration
    public static IAlterColumnOptionSyntax AddIdentity(this IAlterColumnOptionSyntax expression, PostgresGenerationType generation)
    Parameters
    Type Name Description
    IAlterColumnOptionSyntax expression
    PostgresGenerationType generation
    Returns
    Type Description
    IAlterColumnOptionSyntax

    The next step

    Remarks

    This is an equivalent to Alter.Table.AlterColumn.Identity(PostgresGenerationType) Deliberate choice to extend IAlterColumnOptionSyntax rather than IColumnOptionSyntax<TNext, TNextFk> in order to prevent using these methods when adding a column to the table, since it makes no sense. It does mean the syntax migration.Alter.Table("tableName").AlterColumn("columnName") cannot be used since no distinction is made between the the return types of AddColumn or AlterColumn on the IAlterTableColumnAsTypeSyntax interface which is inconvenient but helps prevent misuse.

    | Edit this page View Source

    AsConcurrently(ICreateIndexOptionsSyntax)

    When this option is used, PostgreSQL will build the index without taking any locks that prevent concurrent inserts, updates, or deletes on the table Whereas a standard index build locks out writes (but not reads) on the table until it's done. There are several caveats to be aware of when using this option

    Declaration
    public static ICreateIndexOptionsSyntax AsConcurrently(this ICreateIndexOptionsSyntax expression)
    Parameters
    Type Name Description
    ICreateIndexOptionsSyntax expression
    Returns
    Type Description
    ICreateIndexOptionsSyntax

    The next step

    Remarks

    To use this feature is necessary mark the migration to not use transaction. sample: [Migration(1, TransactionBehavior.None)] public class SomeMigration : Migration

    | Edit this page View Source

    AsConcurrently(ICreateIndexOptionsSyntax, bool)

    When this option is used, PostgreSQL will build the index without taking any locks that prevent concurrent inserts, updates, or deletes on the table Whereas a standard index build locks out writes (but not reads) on the table until it's done. There are several caveats to be aware of when using this option

    Declaration
    public static ICreateIndexOptionsSyntax AsConcurrently(this ICreateIndexOptionsSyntax expression, bool isConcurrently)
    Parameters
    Type Name Description
    ICreateIndexOptionsSyntax expression
    bool isConcurrently

    if should or shouldn't be concurrently

    Returns
    Type Description
    ICreateIndexOptionsSyntax

    The next step

    Remarks

    To use this feature is necessary mark the migration to not use transaction. sample: [Migration(1, TransactionBehavior.None)] public class SomeMigration : Migration

    | Edit this page View Source

    AsOnly(ICreateIndexOptionsSyntax)

    Indicates not to recurse creating indexes on partitions, if the table is partitioned.

    Declaration
    public static ICreateIndexOptionsSyntax AsOnly(this ICreateIndexOptionsSyntax expression)
    Parameters
    Type Name Description
    ICreateIndexOptionsSyntax expression
    Returns
    Type Description
    ICreateIndexOptionsSyntax

    The next step

    | Edit this page View Source

    AsOnly(ICreateIndexOptionsSyntax, bool)

    Indicates not to recurse creating indexes on partitions, if the table is partitioned.

    Declaration
    public static ICreateIndexOptionsSyntax AsOnly(this ICreateIndexOptionsSyntax expression, bool isOnly)
    Parameters
    Type Name Description
    ICreateIndexOptionsSyntax expression
    bool isOnly

    if should or shouldn't be only

    Returns
    Type Description
    ICreateIndexOptionsSyntax

    The next step

    | Edit this page View Source

    DropIdentity(IAlterColumnOptionSyntax, bool)

    Drops an existing identity on the column

    Declaration
    public static IAlterColumnOptionSyntax DropIdentity(this IAlterColumnOptionSyntax expression, bool ifExists)
    Parameters
    Type Name Description
    IAlterColumnOptionSyntax expression
    bool ifExists

    If true and the column is not an identity column, no error is thrown. In this case a notice is issued instead.

    Returns
    Type Description
    IAlterColumnOptionSyntax

    The next step

    Remarks

    Deliberate choice to extend IAlterColumnOptionSyntax rather than IColumnOptionSyntax<TNext, TNextFk> in order to prevent using these methods when adding a column to the table, since it makes no sense. It does mean the syntax migration.Alter.Table("tableName").AlterColumn("columnName") cannot be used since no distinction is made between the the return types of AddColumn or AlterColumn on the IAlterTableColumnAsTypeSyntax interface which is inconvenient but helps prevent misuse.

    | Edit this page View Source

    Filter(ICreateIndexOptionsSyntax, string)

    The constraint expression for a partial index.

    Declaration
    public static ICreateIndexOptionsSyntax Filter(this ICreateIndexOptionsSyntax expression, string filter)
    Parameters
    Type Name Description
    ICreateIndexOptionsSyntax expression
    string filter

    The constraint expression

    Returns
    Type Description
    ICreateIndexOptionsSyntax

    The next step

    | Edit this page View Source

    Identity<TNext, TNextFk>(IColumnOptionSyntax<TNext, TNextFk>, PostgresGenerationType)

    Sets the column's identity generation attribute. To change or remove an existing one, use Alter.Column instead of Alter.Table.AlterColumn

    Declaration
    public static TNext Identity<TNext, TNextFk>(this IColumnOptionSyntax<TNext, TNextFk> expression, PostgresGenerationType generation) where TNext : IFluentSyntax where TNextFk : IFluentSyntax
    Parameters
    Type Name Description
    IColumnOptionSyntax<TNext, TNextFk> expression
    PostgresGenerationType generation
    Returns
    Type Description
    TNext

    The next step

    Type Parameters
    Name Description
    TNext
    TNextFk
    | Edit this page View Source

    Include(ICreateIndexOnColumnSyntax, string)

    Declaration
    public static ICreateIndexNonKeyColumnSyntax Include(this ICreateIndexOnColumnSyntax expression, string columnName)
    Parameters
    Type Name Description
    ICreateIndexOnColumnSyntax expression
    string columnName
    Returns
    Type Description
    ICreateIndexNonKeyColumnSyntax
    | Edit this page View Source

    Include(ICreateIndexOptionsSyntax, string)

    Declaration
    public static ICreateIndexOptionsSyntax Include(this ICreateIndexOptionsSyntax expression, string columnName)
    Parameters
    Type Name Description
    ICreateIndexOptionsSyntax expression
    string columnName
    Returns
    Type Description
    ICreateIndexOptionsSyntax
    | Edit this page View Source

    SetIdentity(IAlterColumnOptionSyntax, PostgresGenerationType)

    Alters the strategy for an existing generated identity on the column

    Declaration
    public static IAlterColumnOptionSyntax SetIdentity(this IAlterColumnOptionSyntax expression, PostgresGenerationType generation)
    Parameters
    Type Name Description
    IAlterColumnOptionSyntax expression
    PostgresGenerationType generation
    Returns
    Type Description
    IAlterColumnOptionSyntax

    The next step

    Remarks

    Deliberate choice to extend IAlterColumnOptionSyntax rather than IColumnOptionSyntax<TNext, TNextFk> in order to prevent using these methods when adding a column to the table, since it makes no sense. It does mean the syntax migration.Alter.Table("tableName").AlterColumn("columnName") cannot be used since no distinction is made between the the return types of AddColumn or AlterColumn on the IAlterTableColumnAsTypeSyntax interface which is inconvenient but helps prevent misuse.

    | Edit this page View Source

    Using(ICreateIndexOptionsSyntax, Algorithm)

    Declaration
    public static ICreateIndexOptionsSyntax Using(this ICreateIndexOptionsSyntax expression, Algorithm algorithm)
    Parameters
    Type Name Description
    ICreateIndexOptionsSyntax expression
    Algorithm algorithm
    Returns
    Type Description
    ICreateIndexOptionsSyntax
    | Edit this page View Source

    Using(ISupportAdditionalFeatures, Algorithm)

    Declaration
    public static void Using(this ISupportAdditionalFeatures additionalFeatures, Algorithm algorithm)
    Parameters
    Type Name Description
    ISupportAdditionalFeatures additionalFeatures
    Algorithm algorithm
    | Edit this page View Source

    UsingBTree(ICreateIndexOptionsSyntax)

    Declaration
    public static ICreateIndexOptionsSyntax UsingBTree(this ICreateIndexOptionsSyntax expression)
    Parameters
    Type Name Description
    ICreateIndexOptionsSyntax expression
    Returns
    Type Description
    ICreateIndexOptionsSyntax
    | Edit this page View Source

    UsingBrin(ICreateIndexOptionsSyntax)

    Declaration
    public static ICreateIndexOptionsSyntax UsingBrin(this ICreateIndexOptionsSyntax expression)
    Parameters
    Type Name Description
    ICreateIndexOptionsSyntax expression
    Returns
    Type Description
    ICreateIndexOptionsSyntax
    | Edit this page View Source

    UsingGin(ICreateIndexOptionsSyntax)

    Declaration
    public static ICreateIndexOptionsSyntax UsingGin(this ICreateIndexOptionsSyntax expression)
    Parameters
    Type Name Description
    ICreateIndexOptionsSyntax expression
    Returns
    Type Description
    ICreateIndexOptionsSyntax
    | Edit this page View Source

    UsingGist(ICreateIndexOptionsSyntax)

    Declaration
    public static ICreateIndexOptionsSyntax UsingGist(this ICreateIndexOptionsSyntax expression)
    Parameters
    Type Name Description
    ICreateIndexOptionsSyntax expression
    Returns
    Type Description
    ICreateIndexOptionsSyntax
    | Edit this page View Source

    UsingHash(ICreateIndexOptionsSyntax)

    Declaration
    public static ICreateIndexOptionsSyntax UsingHash(this ICreateIndexOptionsSyntax expression)
    Parameters
    Type Name Description
    ICreateIndexOptionsSyntax expression
    Returns
    Type Description
    ICreateIndexOptionsSyntax
    | Edit this page View Source

    UsingSpgist(ICreateIndexOptionsSyntax)

    Declaration
    public static ICreateIndexOptionsSyntax UsingSpgist(this ICreateIndexOptionsSyntax expression)
    Parameters
    Type Name Description
    ICreateIndexOptionsSyntax expression
    Returns
    Type Description
    ICreateIndexOptionsSyntax
    • Edit this page
    • View Source
    In this article
    • Fields
      • Concurrently
      • IncludesList
      • IndexAlgorithm
      • IndexFilter
      • Only
    • Properties
      • IdentityGeneration
      • IdentityModificationType
    • Methods
      • AddIdentity(IAlterColumnOptionSyntax, PostgresGenerationType)
      • AsConcurrently(ICreateIndexOptionsSyntax)
      • AsConcurrently(ICreateIndexOptionsSyntax, bool)
      • AsOnly(ICreateIndexOptionsSyntax)
      • AsOnly(ICreateIndexOptionsSyntax, bool)
      • DropIdentity(IAlterColumnOptionSyntax, bool)
      • Filter(ICreateIndexOptionsSyntax, string)
      • Identity<TNext, TNextFk>(IColumnOptionSyntax<TNext, TNextFk>, PostgresGenerationType)
      • Include(ICreateIndexOnColumnSyntax, string)
      • Include(ICreateIndexOptionsSyntax, string)
      • SetIdentity(IAlterColumnOptionSyntax, PostgresGenerationType)
      • Using(ICreateIndexOptionsSyntax, Algorithm)
      • Using(ISupportAdditionalFeatures, Algorithm)
      • UsingBTree(ICreateIndexOptionsSyntax)
      • UsingBrin(ICreateIndexOptionsSyntax)
      • UsingGin(ICreateIndexOptionsSyntax)
      • UsingGist(ICreateIndexOptionsSyntax)
      • UsingHash(ICreateIndexOptionsSyntax)
      • UsingSpgist(ICreateIndexOptionsSyntax)
    Back to top
    Copyright © 2018 Fluent Migrator Project
    Generated by DocFX
    Creative Commons License
    FluentMigrator Documentation by FluentMigrator Project is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.