Exemplo n.º 1
0
 public override void WriteColumnChanges(ColumnModifications col)
 {
     Builder.AppendFormat("alter table {0} alter column {1} ", SqlServerProvider.EscapeIdentifier(col.TableName),
                          SqlServerProvider.EscapeIdentifier(col.Current.Name));
     _writer.Write(col);
     Builder.AppendLine(";");
 }
Exemplo n.º 2
0
 public virtual void Write(ColumnModifications item)
 {
     _item = item;
     _item.Options.Use(Engine);
     Builder.AppendFormat("alter table {0} drop column {1}", Escape(item.TableName), Escape(item.Name));
     WriteEndOptions();
     Builder.AppendLine(";");
 }
Exemplo n.º 3
0
 public override void WriteDropDefault(ColumnModifications col)
 {
     if (!col.Current.DefaultConstraintName.IsNullOrEmpty())
     {
         Builder.AppendFormat("alter table {0} drop constraint {1};\n",
                              SqlServerProvider.EscapeIdentifier(col.TableName),
                              col.Current.DefaultConstraintName);
     }
 }
Exemplo n.º 4
0
        public virtual void Write(ColumnModifications col)
        {
            if (col.Type != null)
            {
                Builder.Append(GetType(col.Type.Value, col.Size));
            }
            else
            {
                Builder.Append(col.Current.Type);
            }

            WriteCollation(col.Collation);

            if (col.Nullable != null)
            {
                WriteNullable(col.Nullable.Value);
            }

            WriteEndColumnOptions(col.Options);
        }
Exemplo n.º 5
0
 public ColumnEditor(string columnName, string table)
 {
     _columnName = columnName;
     _data       = new ColumnModifications(columnName, table);
 }
Exemplo n.º 6
0
 protected override void WriteRenameColumn(ColumnModifications col)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 7
0
 public override void WriteSetDefault(ColumnModifications col)
 {
     Builder.AppendFormat("alter table {0} alter {1} set default '{2}';",
                          MySqlProvider.EscapeIdentifier(col.TableName), MySqlProvider.EscapeIdentifier(col.Name),
                          col.DefaultValue);
 }
Exemplo n.º 8
0
 public override void WriteDropDefault(ColumnModifications col)
 {
     Builder.AppendFormat("alter table {0} alter {1} drop default;",
                          MySqlProvider.EscapeIdentifier(col.TableName), MySqlProvider.EscapeIdentifier(col.Name));
 }
Exemplo n.º 9
0
 /// <summary>
 /// type, size,collate, null
 /// </summary>
 public override void WriteColumnChanges(ColumnModifications col)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 10
0
 public abstract void WriteSetDefault(ColumnModifications col);
Exemplo n.º 11
0
 /// <summary>
 /// type, size,collate, null
 /// </summary>
 public abstract void WriteColumnChanges(ColumnModifications col);
Exemplo n.º 12
0
 protected virtual bool ShouldDropDefault(ColumnModifications col)
 {
     return col.DefaultDropped;
 }
Exemplo n.º 13
0
 protected abstract void WriteRenameColumn(ColumnModifications col);
Exemplo n.º 14
0
 public IModifyTable WithoutOptions()
 {
     _dropped = null;
     return(_parent);
 }
Exemplo n.º 15
0
 public ISupportOptionsForDrop <IModifyColumns> Drop(string name)
 {
     _dropped           = _table.ModifiedColumns[name].Modifications;
     _dropped.IsDropped = true;
     return(this);
 }
Exemplo n.º 16
0
 public override void WriteSetDefault(ColumnModifications col)
 {
     Builder.AppendFormat("alter table {0} add constraint {1} default ('{2}') for {3};\n",
                          SqlServerProvider.EscapeIdentifier(col.TableName),
                          string.Format("DF_{0}_{1}", col.TableName, col.Name), col.DefaultValue, col.Name);
 }
Exemplo n.º 17
0
 protected override bool ShouldDropDefault(ColumnModifications col)
 {
     return base.ShouldDropDefault(col) || col.HasChangedStructure || col.IsDropped;
 }
Exemplo n.º 18
0
 protected override void WriteRenameColumn(ColumnModifications col)
 {
     Builder.AppendFormat("exec sp_rename '{2}.{0}','{1}','COLUMN';\n", col.Current.Name, col.NewName, Table.Name);
 }
Exemplo n.º 19
0
 public override void WriteSetDefault(ColumnModifications col)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 20
0
 public ColumnEditor(string columnName,string table)
 {
     _columnName = columnName;
     _data = new ColumnModifications(columnName,table);
 }
Exemplo n.º 21
0
 public override void Write(ColumnModifications col)
 {
     col.Collation = null;
     base.Write(col);
 }
Exemplo n.º 22
0
 public override void WriteDropDefault(ColumnModifications col)
 {
     Builder.AppendFormat("alter table {0} alter {1} drop default;\n\r", col.TableName, col.Name);
 }
Exemplo n.º 23
0
 /// <summary>
 /// type, size,collate, null
 /// </summary>
 public override void WriteColumnChanges(ColumnModifications col)
 {
     var w = new MySqlColumnWriter(Builder);
     Builder.AppendFormat("alter table {0} modify ", MySqlProvider.EscapeIdentifier(col.Name));
     w.Write(col);
 }
Exemplo n.º 24
0
 /// <summary>
 /// type, size,collate, null
 /// </summary>
 public override void WriteColumnChanges(ColumnModifications col)
 {
     var w = new PostgresColumnWriter(Builder);
     w.Write(col);
 }
Exemplo n.º 25
0
 protected override void WriteRenameColumn(ColumnModifications col)
 {
     Builder.AppendFormat("alter table {0} rename {1} to {2};\n\r",Escape(col.TableName),Escape(col.Current.Name),Escape(col.NewName));
 }
Exemplo n.º 26
0
 public override void WriteSetDefault(ColumnModifications col)
 {
     Builder.AppendFormat("alter table {0} alter {1} set default {2};\n\r", col.TableName, col.Name,
                          col.DefaultValue);
 }
Exemplo n.º 27
0
 protected override void WriteRenameColumn(ColumnModifications col)
 {
     Builder.AppendFormat("ALTER TABLE {0} CHANGE {1} {2}",Escape(col.TableName),Escape(col.Current.Name),col.Current.Definition.Replace(col.Current.Name,col.NewName));
     Builder.AppendLine(";");
 }
Exemplo n.º 28
0
 public override void WriteDropDefault(ColumnModifications col)
 {
     throw new NotImplementedException();
 }