【问题标题】:Migrate down in golang migrate does not drop tables在 golang 中向下迁移 migrate 不会删除表
【发布时间】:2022-07-07 12:25:28
【问题描述】:

我有以下 down 脚本,名为 000001_init_schema.down.sql

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

当我跑步时

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

没有任何变化。

这是为什么呢?

我对应的up 脚本按预期工作。

【问题讨论】:

  • 错字,已修复!

标签: postgresql go golang-migrate


【解决方案1】:

你在哪里打错了?我有这样的问题

【讨论】:

    猜你喜欢
    • 2021-02-07
    • 2021-02-13
    • 2020-12-01
    • 2020-05-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-24
    • 1970-01-01
    相关资源
    最近更新 更多