Skip to content

Commit b5968c8

Browse files
Add new error type for no version schema found
Make `LatestVersionRemote` return a specific error when no version schema is found. This is distinct from the case where no migrations have been applied, as migrations may exist but not have a version schema such as for an inferred migration or a migration craeted with version schema creation disabled.
1 parent a4f2b3a commit b5968c8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/roll/latest.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
var (
1414
ErrNoMigrationFiles = fmt.Errorf("no migration files found")
1515
ErrNoMigrationApplied = fmt.Errorf("no migrations applied")
16+
ErrNoVersionSchema = fmt.Errorf("no version schemas found")
1617
)
1718

1819
// LatestVersionLocal returns the version schema name of the last migration in
@@ -46,7 +47,7 @@ func (m *Roll) LatestVersionRemote(ctx context.Context) (string, error) {
4647
}
4748

4849
if latestVersion == nil {
49-
return "", ErrNoMigrationApplied
50+
return "", ErrNoVersionSchema
5051
}
5152

5253
return *latestVersion, nil

0 commit comments

Comments
 (0)