@@ -258,7 +258,7 @@ func resolveAlterColumn(ctx *sql.Context, a *Analyzer, n sql.Node, scope *plan.S
258258 return nil , transform .SameTree , err
259259 }
260260
261- sch , err = validateAddColumn ( initialSch , sch , n .(* plan.AddColumn ))
261+ sch , err = ValidateAddColumn ( sch , n .(* plan.AddColumn ))
262262 if err != nil {
263263 return nil , transform .SameTree , err
264264 }
@@ -395,7 +395,10 @@ func validateRenameColumn(initialSch, sch sql.Schema, rc *plan.RenameColumn) (sq
395395 return renameInSchema (sch , rc .ColumnName , rc .NewColumnName , nameable .Name ()), nil
396396}
397397
398- func validateAddColumn (initialSch sql.Schema , schema sql.Schema , ac * plan.AddColumn ) (sql.Schema , error ) {
398+ // ValidateAddColumn validates that the column specified in |ac| can be added to the specified
399+ // |schema|. A new Schema is returned, with the added column, if the column can be added. Otherwise,
400+ // an error is returned if there are any validation errors.
401+ func ValidateAddColumn (schema sql.Schema , ac * plan.AddColumn ) (sql.Schema , error ) {
399402 table := ac .Table
400403 nameable := table .(sql.Nameable )
401404
@@ -828,8 +831,6 @@ func validateAutoIncrementAdd(schema sql.Schema, keyColumns map[string]bool) err
828831 return nil
829832}
830833
831- const textIndexPrefix = 1000
832-
833834func schToColMap (sch sql.Schema ) map [string ]* sql.Column {
834835 colMap := make (map [string ]* sql.Column , len (sch ))
835836 for _ , col := range sch {
0 commit comments