コード例 #1
0
 /// <summary>
 /// Drops an existing identity on the column
 /// </summary>
 /// <param name="expression"></param>
 /// <param name="ifExists">If true and the column is not an identity column, no error is thrown.  In this case a notice is issued instead.</param>
 /// <returns>The next step</returns>
 /// <remarks>Deliberate choice to extend IAlterColumnOptionSyntax rather than IColumnOptionSyntax&lt;TNext, TNextFk&gt;
 /// 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.
 /// </remarks>
 public static IAlterColumnOptionSyntax DropIdentity(this IAlterColumnOptionSyntax expression, bool ifExists)
 => SetIdentity(expression, null, ifExists ? PostgresIdentityModificationType.DropIfExists : PostgresIdentityModificationType.Drop, GetColumn(expression));
コード例 #2
0
 /// <summary>
 /// Alters the strategy for an existing generated identity on the column
 /// </summary>
 /// <param name="expression"></param>
 /// <param name="generation"></param>
 /// <returns>The next step</returns>
 /// <remarks>Deliberate choice to extend IAlterColumnOptionSyntax rather than IColumnOptionSyntax&lt;TNext, TNextFk&gt;
 /// 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.
 /// </remarks>
 public static IAlterColumnOptionSyntax SetIdentity(this IAlterColumnOptionSyntax expression, PostgresGenerationType generation)
 => SetIdentity(expression, generation, PostgresIdentityModificationType.Set, GetColumn(expression));