Small fix: migration funcs don't have to be exported.
This commit is contained in:
parent
b70c6bd8e2
commit
39b231b780
1 changed files with 4 additions and 4 deletions
8
main.go
8
main.go
|
@ -558,7 +558,7 @@ func connectToPostgreSQL(pgConnStr string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform DB migrations
|
// Perform DB migrations
|
||||||
err = MigrateFS(db, migrations.FS, ".")
|
err = migrateFS(db, migrations.FS, ".")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -577,7 +577,7 @@ func connectToPostgreSQL(pgConnStr string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Migrate(db *sql.DB, dir string) error {
|
func migrate(db *sql.DB, dir string) error {
|
||||||
err := goose.SetDialect("postgres")
|
err := goose.SetDialect("postgres")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("migrate: %w", err)
|
return fmt.Errorf("migrate: %w", err)
|
||||||
|
@ -590,7 +590,7 @@ func Migrate(db *sql.DB, dir string) error {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func MigrateFS(db *sql.DB, migrationFS fs.FS, dir string) error {
|
func migrateFS(db *sql.DB, migrationFS fs.FS, dir string) error {
|
||||||
// In case the dir is an empty string, they probably meant the current directory and goose wants a period for that.
|
// In case the dir is an empty string, they probably meant the current directory and goose wants a period for that.
|
||||||
if dir == "" {
|
if dir == "" {
|
||||||
dir = "."
|
dir = "."
|
||||||
|
@ -600,5 +600,5 @@ func MigrateFS(db *sql.DB, migrationFS fs.FS, dir string) error {
|
||||||
// Ensure that we remove the FS on the off chance some other part of our app uses goose for migrations and doesn't want to use our FS.
|
// Ensure that we remove the FS on the off chance some other part of our app uses goose for migrations and doesn't want to use our FS.
|
||||||
goose.SetBaseFS(nil)
|
goose.SetBaseFS(nil)
|
||||||
}()
|
}()
|
||||||
return Migrate(db, dir)
|
return migrate(db, dir)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue