Small fix: migration funcs don't have to be exported.
All checks were successful
Build Docker image / build (push) Successful in 1m6s
Build Golang packages / release (push) Has been skipped

This commit is contained in:
Pieter Hollander 2024-07-26 22:29:05 +02:00
parent b70c6bd8e2
commit 39b231b780
Signed by: pieter
SSH key fingerprint: SHA256:HbX+9cBXsop9SuvL+mELd29sK+7DehFfdVweFVDtMSg

View file

@ -558,7 +558,7 @@ func connectToPostgreSQL(pgConnStr string) error {
}
// Perform DB migrations
err = MigrateFS(db, migrations.FS, ".")
err = migrateFS(db, migrations.FS, ".")
if err != nil {
log.Fatal(err)
}
@ -577,7 +577,7 @@ func connectToPostgreSQL(pgConnStr string) error {
return nil
}
func Migrate(db *sql.DB, dir string) error {
func migrate(db *sql.DB, dir string) error {
err := goose.SetDialect("postgres")
if err != nil {
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.
if 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.
goose.SetBaseFS(nil)
}()
return Migrate(db, dir)
return migrate(db, dir)
}