protected override string ParseColumnAlter(TableColumnSchema mColumn, TableColumnSchema eColumn) { return(string.Format(@" [{0}] {1}{2} ", mColumn.Name, MssqlSchemaLoader.TypeDbsmToSql(mColumn), mColumn.Nullable ? string.Empty : @" NOT NULL")); }
/// <summary> /// Создать схему метаданных из исходной базы /// </summary> /// <param name="connStr"></param> public override DBSchema LoadExistingSchema(string connStr) { var schema = MssqlSchemaLoader.LoadSchema(connStr); foreach (var table in schema.Tables) { table.Keys = table.Keys .Where(key => key.KeyType != ConstraintType.Default) .ToArray(); } return(schema); }
protected override string ParseColumn(TableColumnSchema column) { var stat = new StringBuilder(); stat.Append(MakeDdlElementName(column.Name) + MssqlSchemaLoader.TypeDbsmToSql(column)); if (column.AutoIncrement) { stat.AppendFormat(@" IDENTITY ({0},{1})", column.Seed, column.Increment); } else if (!string.IsNullOrEmpty(column.DefaultValue)) { stat.Append(@" DEFAULT " + column.DefaultValue); } if (!column.Nullable) { stat.Append(@" NOT NULL"); } return(stat.ToString()); }