mirror of
https://github.com/ent/ent.git
synced 2026-05-04 00:20:58 +03:00
dialect/sql/schema: fix bug in atlas integration when working WithDropIndex/WithDropColumn (#2374)
* dialect/sql/schema: fix no change condition in atlas * dialect/sql/schema: fix bug in atlas integration when working WithDropIndex/WithDropColumn Co-authored-by: Zeev Manilovich <zeevmanilovich@gmail.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
"ariga.io/atlas/sql/migrate"
|
||||
"ariga.io/atlas/sql/schema"
|
||||
|
||||
"entgo.io/ent/dialect"
|
||||
entsql "entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/schema/field"
|
||||
@@ -272,18 +273,18 @@ func (m *Migrate) setupAtlas() error {
|
||||
if m.withFixture {
|
||||
return errors.New("sql/schema: WithFixture(true) does not work in Atlas migration")
|
||||
}
|
||||
k := DropIndex | DropColumn
|
||||
skip := DropIndex | DropColumn
|
||||
if m.atlas.skip != NoChange {
|
||||
k = m.atlas.skip
|
||||
skip = m.atlas.skip
|
||||
}
|
||||
if m.dropIndexes {
|
||||
k |= ^DropIndex
|
||||
skip &= ^DropIndex
|
||||
}
|
||||
if m.dropColumns {
|
||||
k |= ^DropColumn
|
||||
skip &= ^DropColumn
|
||||
}
|
||||
if k == NoChange {
|
||||
m.atlas.diff = append(m.atlas.diff, filterChanges(k))
|
||||
if skip != NoChange {
|
||||
m.atlas.diff = append(m.atlas.diff, filterChanges(skip))
|
||||
}
|
||||
if m.atlas.dir != nil && m.atlas.fmt == nil {
|
||||
m.atlas.fmt = migrate.DefaultFormatter
|
||||
|
||||
Reference in New Issue
Block a user