dialect/sql/schema: add field collation support for postgres

This commit is contained in:
Ariel Mashraki
2021-05-10 20:18:33 +03:00
committed by Ariel Mashraki
parent 53e885cbff
commit f7db15ccbb
5 changed files with 10 additions and 13 deletions

View File

@@ -7,6 +7,7 @@ package schema
import (
"context"
"fmt"
"strconv"
"strings"
"unicode"
@@ -359,6 +360,9 @@ func (d *Postgres) addColumn(c *Column) *sql.ColumnBuilder {
}
c.nullable(b)
c.defaultValue(b)
if c.Collation != "" {
b.Attr("COLLATE " + strconv.Quote(c.Collation))
}
return b
}
@@ -530,7 +534,6 @@ func arrayType(t string) bool {
// foreignKeys populates the tables foreign keys using the information_schema tables
func (d *Postgres) foreignKeys(ctx context.Context, tx dialect.Tx, tables []*Table) error {
var tableLookup = make(map[string]*Table)
// TODO: include schema
for _, t := range tables {
tableLookup[t.Name] = t
}