public bool Alter(string column, AlterColumnAction alterColumnAction) { var index = GetIndex(column); if (index == -1) { return(false); } var previous = Columns[index]; var type = previous.Type; var isNullable = previous.IsNullable; var isAutoIncrementByType = previous.IsAutoIncrementByType; switch (alterColumnAction) { case DropNotNull _: isNullable = true; break; case SetNotNull _: isNullable = false; break; case AlterType a: isAutoIncrementByType = a.Type.ToUpper().Equals("SERIAL") || a.Type.ToUpper().Equals("BIGSERIAL"); type = ColumnParser.ParseType(a.Type); break; } Columns[index] = new Column(previous.Name, type, isNullable, previous.IsAutoIncrementByDefinition, isAutoIncrementByType); return(true); }
public AlterColumnDefinitionImpl(SQLVendorImpl vendor, String colName, AlterColumnAction action) : base(vendor) { ArgumentValidator.ValidateNotNull(nameof(colName), colName); ArgumentValidator.ValidateNotNull(nameof(action), action); this._columnName = colName; this._alterAction = action; }
public AlterColumn(string column, AlterColumnAction alterColumnAction) { Column = column; AlterColumnAction = alterColumnAction; }
public virtual AlterColumnDefinition NewAlterColumnDefinition(String columnName, AlterColumnAction action) { return(new AlterColumnDefinitionImpl(this.vendor, columnName, action)); }