dialect/sql/schema: allow ariga.io/atlas schema diff to be extended (#3514)

By not relying on the SchemaDiff signature, we allow the schema.Differ to be extended without introducing breaking changes to ent
This commit is contained in:
Ariel Mashraki
2023-05-01 17:14:17 +03:00
committed by GitHub
parent e04f07d447
commit a792f429a6
2 changed files with 4 additions and 2 deletions

View File

@@ -2748,7 +2748,7 @@ type (
// custom clause for locking.
clause string
}
// LockOption allows configuring the LockConfig using functional options.
// LockOption allows configuring the LockOptions using functional options.
LockOption func(*LockOptions)
)

View File

@@ -1153,7 +1153,9 @@ func (r *diffDriver) RealmDiff(_, _ *schema.Realm) ([]schema.Change, error) {
// SchemaDiff creates the diff between two schemas, but includes "diff hooks".
func (r *diffDriver) SchemaDiff(from, to *schema.Schema) ([]schema.Change, error) {
var d Differ = DiffFunc(r.Driver.SchemaDiff)
var d Differ = DiffFunc(func(current, desired *schema.Schema) ([]schema.Change, error) {
return r.Driver.SchemaDiff(current, desired)
})
for i := len(r.hooks) - 1; i >= 0; i-- {
d = r.hooks[i](d)
}