public void Visit(StringBuilder builder, AddColumnCommand command) { if (ExecuteCustomInterpreter(command)) { return; } builder.AppendFormat("alter table {0} add ", _dialectLazy.Value.QuoteForTableName(PrefixTableName(command.TableName))); if (command.DbType != DbType.Object) { var postgisDialect = new PostGisDialect(); var createSql = postgisDialect.GetSpatialCreateString("", command.TableName, command.ColumnName, 4326, "Point", 3, true); builder.Clear().Append(createSql); } else { Visit(builder, (CreateColumnCommand)command); _sqlStatements.Add(builder.ToString()); } }
public void Visit(StringBuilder builder, AlterColumnCommand command) { if (ExecuteCustomInterpreter(command)) { return; } // builder.AppendFormat("alter table {0} alter column {1} ", _dialectLazy.Value.QuoteForTableName(PrefixTableName(command.TableName)), _dialectLazy.Value.QuoteForColumnName(command.ColumnName)); // type if (command.DbType != DbType.Object) { var postgisDialect = new PostGisDialect(); var createSql = postgisDialect.GetSpatialCreateString("", command.TableName, command.ColumnName, 4326, "Point", 3, true); builder.Clear().Append(createSql); // builder.Append(GetTypeName(_dialectLazy.Value, command.DbType, command.Length, command.Precision, command.Scale)); } else { if (command.Length > 0 || command.Precision > 0 || command.Scale > 0) { throw new OrchardException(T("Error while executing data migration: you need to specify the field's type in order to change its properties")); } } // [default value] if (command.Default != null) { builder.Append(" set default ").Append(ConvertToSqlValue(command.Default)).Append(Space); } _sqlStatements.Add(builder.ToString()); }