public void AddColumnDefinition(StringBuilder sb, Column c)
 {
     sb.AppendFormat(QUOTE_FORMAT, c.Name);
     sb.Append(" ").Append(DbTypeMap.GetTypeName(c.DbType, c.Size));
     if (c.Property.Match(ColumnProperty.Identity))
     {
         sb.Append(" IDENTITY(1,1)");
     }
     sb.Append(c.Property.Match(ColumnProperty.Null) ? " NULL" : " NOT NULL");
     if (null != c.DefaultValue)
     {
         sb.Append(" DEFAULT ").Append(c.DefaultValue);
     }
 }
 public void AddColumn(Column c)
 {
     Columns.Add(c);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Checks if a column exists and creates it if it doesn't.
 /// </summary>
 /// <param name="c">The column definition to check and create.</param>
 public void EnsureColumn(Column c)
 {
     if (!Driver.Inspect<IColumnExistsOperation>(op =>
                                                     {
                                                         op.TableName = SCHEMA_VERSION_TABLE;
                                                         op.ColumnName = c.Name;
                                                     }))
     {
         Driver.Run<IAddColumnOperation>(op =>
                              {
                                  op.TableName = SCHEMA_VERSION_TABLE;
                                  op.Column = c;
                              });
     }
 }