3

I have the following down script named 000001_init_schema.down.sql

DROP TABLE IF EXISTS entries;
DROP TABLE IF EXISTS transfers;
DROP TABLE IF EXISTS accounts;

When I run

migrate -path db/migrations --database "postgresql://root:secret@localhost:5432/accountsdb?sslmode=disable" -verbose down 
▶ make migratedown
migrate -path db/migrations --database "postgresql://root:secret@localhost:5432/accountsdb?sslmode=disable" -verbose down
2022/02/12 21:43:19 Are you sure you want to apply all down migrations? [y/N]
y
2022/02/12 21:43:21 Applying all down migrations
2022/02/12 21:43:21 no change
2022/02/12 21:43:21 Finished after 2.242449209s
2022/02/12 21:43:21 Closing source and database

nothing changes.

why is that?

My corresponding up script works as expected.

pkaramol
  • 16,451
  • 43
  • 149
  • 324

1 Answers1

0

To better assist you with your issue, it would be helpful if you could provide more specific details about the relevant packages or libraries, the programming language and anything involved. This additional information can aid in diagnosing the problem more accurately and providing a tailored solution.

The problem you're encountering might be related to the version of migrate you are using. I think you're using https://github.com/golang-migrate/migrate. Make sure that the go-migrate version you are using supports dropping tables for the specific Go version you have.

In my case, I was using migrate version 4.16.0 and Go version 1.20.4, and it worked successfully for me.

Additionally, it's always a good idea to stay updated with the latest versions, as newer releases often include bug fixes and improvements. You can check the official documentation and release notes for both go-migrate and Go to ensure compatibility and explore any additional information or solutions provided there.