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

Make rollback more informative #45

Open
ka8725 opened this issue Mar 1, 2024 · 0 comments
Open

Make rollback more informative #45

ka8725 opened this issue Mar 1, 2024 · 0 comments
Assignees

Comments

@ka8725
Copy link
Member

ka8725 commented Mar 1, 2024

When the gem automatically rolls back, it's unclear why it was rolled back. Show some information in the output.

For example, this is a migration that was tried to be rolled back on running rails db:migrate:

== 20240208135613 AddNotNullConstraintToCategoryIdInProjects: migrating =======
-- change_column_null(:projects, :category_id, false)
   -> 0.0422s
== 20240208135613 AddNotNullConstraintToCategoryIdInProjects: migrated (0.0423s)

== 20240212121941 CreateQueSchema: reverting ==================================
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

uninitialized constant CreateQueSchema::Que

    Que.migrate!(version: 0)
    ^^^
Did you mean?  Queue
~/tmp/migrated/20240212121941_create_que_schema.rb:11:in `down'

Caused by:
NameError: uninitialized constant CreateQueSchema::Que

    Que.migrate!(version: 0)
    ^^^
Did you mean?  Queue
~/tmp/migrated/20240212121941_create_que_schema.rb:11:in `down'
Tasks: TOP => db:_dump => db:rollback_branches
(See full trace by running task with --trace)

Note that it needs to be clarified why it was tried to roll it back. Add some info like: actual_db_schema rolls back this migration.

Also, it should not stop the migration on error raised, suppress it, show the error in the output, and move on.

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

No branches or pull requests

2 participants