mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
dialect/sql/schema: add name to versioned migration files (#2375)
* add name to versioned migration files * Skip writing migration files if the plan has no changes
This commit is contained in:
@@ -364,7 +364,7 @@ func (m *Migrate) atDiff(ctx context.Context, conn dialect.ExecQuerier, tables .
|
||||
return nil, err
|
||||
}
|
||||
// Plan changes.
|
||||
return drv.PlanChanges(ctx, "", changes)
|
||||
return drv.PlanChanges(ctx, "changes", changes)
|
||||
}
|
||||
|
||||
type db struct{ dialect.ExecQuerier }
|
||||
|
||||
@@ -171,6 +171,10 @@ func (m *Migrate) Diff(ctx context.Context, tables ...*Table) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Skip if the plan has no changes
|
||||
if len(plan.Changes) == 0 {
|
||||
return nil
|
||||
}
|
||||
return migrate.NewPlanner(nil, m.atlas.dir, migrate.WithFormatter(m.atlas.fmt)).WritePlan(plan)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user