Skip to content

Commit

Permalink
refactor load migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
judezhu committed Apr 9, 2024
1 parent 5ee8984 commit 46a0d19
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/spanner/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ func LoadMigrations(dir string) (Migrations, error) {
return nil, err
}

return LoadMigrationFiles(dir, files)
}

func LoadMigrationFiles(baseDir string, files []os.DirEntry) (Migrations, error) {
var migrations Migrations

versions := map[uint64]string{}

for _, f := range files {
if f.IsDir() {
continue
Expand All @@ -106,7 +109,7 @@ func LoadMigrations(dir string) (Migrations, error) {
continue
}

file, err := os.ReadFile(filepath.Join(dir, filename))
file, err := os.ReadFile(filepath.Join(baseDir, filename))
if err != nil {
continue
}
Expand Down

0 comments on commit 46a0d19

Please sign in to comment.