diff --git a/dialect/sql/schema/atlas.go b/dialect/sql/schema/atlas.go index 555f411008..23e3cff6de 100644 --- a/dialect/sql/schema/atlas.go +++ b/dialect/sql/schema/atlas.go @@ -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 } diff --git a/dialect/sql/schema/migrate.go b/dialect/sql/schema/migrate.go index 9fac1a8069..91adcdbc49 100644 --- a/dialect/sql/schema/migrate.go +++ b/dialect/sql/schema/migrate.go @@ -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) }