LeTadas
LeTadas

Reputation: 3556

golang-migrate no change error on initial migration

I'm using golang-migrate for managing migrations everything seems to work correctly when running tests on github actions CI, but I can't make it work when running on docker image. I just keep getting a no change error. Connection to database is established and .sql migrations work as well. Any suggestions on how could I debug what's actually going on?

func runMigrations(databaseUrl string) {
    m, err := migrate.New(
        "file://migrations/",
        databaseUrl,
    )

    if err != nil {
        log.Fatalf("Error loading migrations: %v", err)
    }

    if err := m.Up(); err != nil {
        log.Printf("Error migrating Up: %v", err)
    }
}

Upvotes: 3

Views: 6434

Answers (1)

Михал Палыч
Михал Палыч

Reputation: 81

Probably you need to add a check err != migrate.ErrNoChange to your code. In this case, "migrate" is the name of the package

https://github.com/golang-migrate/migrate/issues/100

Upvotes: 8

Related Questions