I am a new user of golang-migrate.
I have run some migrations that executed with success.
I am on development mode so I want to fore re-run the migrations so in psql
shell and after connecting to my database, I executed drop database schema_migrations
The problem now is that when I run the code that executes the migrations (shown below)
func RunMigrations() {
m, err := migrate.New(
"file://db/migrations",
"postgres://postgres:postgres@localhost:5432/mydatabase?sslmode=disable")
if err != nil {
log.Fatal(err)
}
if err := m.Up(); err != nil {
if err.Error() == "no change" {
log.Println("no change made by migration scripts")
} else {
log.Fatal(err)
}
}
}
I get this error
Dirty database version 2. Fix and force version.
What is this error about and how can I address this?