dialect/sql/schema: allow setting JSON default values on pg, sqlite and maria (#3081)

This commit is contained in:
Ariel Mashraki
2022-11-11 07:41:21 +02:00
committed by GitHub
parent b86bc12db9
commit 3b5a535801
14 changed files with 258 additions and 13 deletions

View File

@@ -642,6 +642,9 @@ func (d *Postgres) foreignKeys(ctx context.Context, tx dialect.Tx, tables []*Tab
t.AddForeignKey(newFk)
}
}
if err := rows.Close(); err != nil {
return err
}
if err := rows.Err(); err != nil {
return err
}
@@ -683,6 +686,11 @@ func (d *Postgres) atTable(t1 *Table, t2 *schema.Table) {
}
}
func (d *Postgres) supportsDefault(*Column) bool {
// PostgreSQL supports default values for all standard types.
return true
}
func (d *Postgres) atTypeC(c1 *Column, c2 *schema.Column) error {
if c1.SchemaType != nil && c1.SchemaType[dialect.Postgres] != "" {
t, err := postgres.ParseType(strings.ToLower(c1.SchemaType[dialect.Postgres]))