public override void RenameColumn(ColumnInfo column, string newcol) { var newcoldef = column.CloneColumn(); newcoldef.Name = newcol; ChangeColumn(column, newcoldef, new ConstraintInfo[] { }); }
public override void ChangeColumn(ColumnInfo oldcol, ColumnInfo newcol, IEnumerable <ConstraintInfo> constraints) { if (DbDiffTool.EqualsColumns(oldcol, newcol, false, false)) { DropDefault(oldcol); if (oldcol.Name != newcol.Name) { RenameColumn(oldcol, newcol.Name); } CreateDefault(newcol); } else { DropDefault(oldcol); if (oldcol.Name != newcol.Name) { RenameColumn(oldcol, newcol.Name); } Put("^alter ^table %f ^alter ^column %i ", newcol.OwnerTable.FullName, newcol.Name); // remove autoincrement flag var newcol2 = newcol.CloneColumn(); newcol2.SetDummyTable(newcol.OwnerTable.FullName); newcol2.AutoIncrement = false; ColumnDefinition(newcol2, false, true, true); EndCommand(); CreateDefault(newcol); this.CreateConstraints(constraints); } }
public void CreateColumn(TableInfo table, ColumnInfo newcol, PlanPosition pos = PlanPosition.End) { TableInfo tbl = Structure.FindOrCreateTable(table.FullName); AddOperation(new AlterOperation_CreateColumn { ParentTable = tbl, NewObject = newcol.CloneColumn() }, pos); }
public void ChangeColumn(ColumnInfo column, ColumnInfo newcolumn) { ColumnInfo col = Structure.FindOrCreateColumn(column); AddOperation(new AlterOperation_ChangeColumn { OldObject = col, ParentTable = col.OwnerTable, NewObject = newcolumn.CloneColumn() }); }