mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
dialect/sql/schema: allow setting JSON default values on pg, sqlite and maria (#3081)
This commit is contained in:
@@ -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]))
|
||||
|
||||
Reference in New Issue
Block a user