mirror of
https://github.com/ent/ent.git
synced 2026-04-28 05:30:56 +03:00
dialect/sql/schema: ensure consistency of NotCleanError (#3310)
* dialect/sql/schema: ensure consistency of NotCleanError For https://github.com/ariga/atlas/pull/1454 * get rid of cerr var https://github.com/ariga/atlas/pull/1454#discussion_r1102391750
This commit is contained in:
@@ -726,7 +726,7 @@ func (a *Atlas) planReplay(ctx context.Context, name string, tables []*Table) (*
|
||||
return nil, err
|
||||
}
|
||||
if len(s.Tables) > 0 {
|
||||
return nil, migrate.NotCleanError{Reason: fmt.Sprintf("found table %q", s.Tables[0].Name)}
|
||||
return nil, &migrate.NotCleanError{Reason: fmt.Sprintf("found table %q", s.Tables[0].Name)}
|
||||
}
|
||||
// Replay the migration directory on the database.
|
||||
ex, err := migrate.NewExecutor(a.atDriver, a.dir, &migrate.NopRevisionReadWriter{})
|
||||
|
||||
@@ -425,7 +425,7 @@ func Versioned(t *testing.T, drv sql.ExecQuerier, devURL string, client *version
|
||||
hf, err := dir.Checksum()
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, migrate.WriteSumFile(dir, hf))
|
||||
require.ErrorAs(t, client.Schema.Diff(ctx, opts...), &migrate.NotCleanError{})
|
||||
require.ErrorAs(t, client.Schema.Diff(ctx, opts...), new(*migrate.NotCleanError))
|
||||
|
||||
// Diffing by replaying should not create new files.
|
||||
require.Equal(t, 2, countFiles(t, dir))
|
||||
|
||||
Reference in New Issue
Block a user