Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbmate requires each migration to define a down block with '-- migrate:down' when it defined #472

Open
nolinkspl opened this issue Sep 6, 2023 · 5 comments

Comments

@nolinkspl
Copy link

Description
I've updated dbmate to actual version and some of my migrations became failed.

  • Version: 2.6.0
  • Database: postgres
  • Operating System: Windows WSL: Ubuntu 22.02: image: ghcr.io/amacneil/dbmate

Steps To Reproduce

Errors appears if something written after -- migrate:down, i.e. transaction:false
-- migrate:down transaction:false

Expected Behavior
It works with transaction:false or ignore unrecognized params

@nolinkspl nolinkspl added the bug label Sep 6, 2023
@nolinkspl
Copy link
Author

I can create PR if you approve the issue

@DGulshan
Copy link

Facing the same issue.

@dossy
Copy link
Collaborator

dossy commented Nov 15, 2023

I'm trying to reproduce this issue:

root@c2a4e68d4451:/src# printf -- "-- migrate:up\ncreate table test_issue_472 (id integer);\n-- migrate:down transaction:false\ndrop table test_issue_472;\n" > testdata/db/migrations/472_test_migrate_down_transaction.sql

root@c2a4e68d4451:/src# cat testdata/db/migrations/472_test_migrate_down_transaction.sql 
-- migrate:up
create table test_issue_472 (id integer);
-- migrate:down transaction:false
drop table test_issue_472;

root@c2a4e68d4451:/src# dist/dbmate -u $POSTGRES_TEST_URL -d testdata/db/migrations up
Creating: dbmate_test
Applying: 20151129054053_test_migration.sql
Applying: 20200227231541_test_posts.sql
Applying: 472_test_migrate_down_transaction.sql
Writing: ./db/schema.sql

root@c2a4e68d4451:/src# dist/dbmate -u $POSTGRES_TEST_URL -d testdata/db/migrations down
Rolling back: 472_test_migrate_down_transaction.sql
Writing: ./db/schema.sql

I cannot reproduce the problem with the latest pre-release build:

root@c2a4e68d4451:/src# git --no-pager log --oneline --no-decorate -1
1b5ca4f Bump actions/setup-node from 3 to 4 (#494)

root@c2a4e68d4451:/src# dist/dbmate --version
dbmate version 2.7.0

root@c2a4e68d4451:/src# PGPASSWORD=postgres psql -h postgres -U postgres -tc "select version();" 
 PostgreSQL 10.21 (Debian 10.21-1.pgdg90+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit

Can anyone who is affected by this issue please provide a minimal reproduction migration file that triggers this issue so I can try to reproduce it?

@dossy
Copy link
Collaborator

dossy commented Nov 16, 2023

I just noticed that @nolinkspl is on Windows, so this may be a duplicate of #213, which I believe will be fixed by #496.

@dossy
Copy link
Collaborator

dossy commented Nov 18, 2023

@nolinkspl Now that v2.8.0 has been released (#497), can you please update to that version and see if you can still reproduce the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants