Skip to content

Commit

Permalink
fix(migrations): Using current directory for the default location of …
Browse files Browse the repository at this point in the history
…migrations (#35)

Using current directory for the default location of migrations
  • Loading branch information
Jacobbrewer1 authored Oct 28, 2024
1 parent 1ab242e commit fd1ed49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/schema/cmd_migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (m *migrateCmd) Usage() string {
func (m *migrateCmd) SetFlags(f *flag.FlagSet) {
f.BoolVar(&m.up, "up", false, "Migrate up.")
f.BoolVar(&m.down, "down", false, "Migrate down.")
f.StringVar(&m.migrationLocation, "loc", "./migrations", "The location of the migrations.")
f.StringVar(&m.migrationLocation, "loc", ".", "The location of the migrations.")
f.IntVar(&m.steps, "steps", 0, "The number of steps to migrate (0 means all).")
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/migrations/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ func (v *versioning) MigrateUp() error {
files = filterFiles(files, ".sql")
files = filterFiles(files, up+".sql")

if len(files) == 0 {
slog.Info("No files to migrate up")
return nil
}

// Order the files by datetime at the prefix.
orderedFiles, err := orderFiles(files)
if err != nil {
Expand Down

0 comments on commit fd1ed49

Please sign in to comment.