プロジェクト

全般

プロフィール

Vote #81855

完了

Fix to use a correct exception class ActiveRecord::IrreversibleMigration in migrations

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Code cleanup/refactoring_30
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
30
version_id:
155
issue_org_id:
36770
author_id:
332
assigned_to_id:
332
comments:
1
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

When I tried to perform a reverse migration of @db/migrate/20090503121510_drop_members_role_id.rb@, I came across the following "uninitialized constant" error.

== 20090503121510 DropMembersRoleId: reverting ================================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

uninitialized constant DropMembersRoleId::IrreversibleMigration

    raise IrreversibleMigration
          ^^^^^^^^^^^^^^^^^^^^^
/path/to/redmine/db/migrate/20090503121510_drop_members_role_id.rb:7:in `down'

It is due to an incorrect exception class given to @raise@ method. The exception class should be @ActiveRecord::IrreversibleMigration@ instead of @IrreversibleMigration@. I am attaching a patch to fix it. You will get the following error after the fix.

== 20090503121510 DropMembersRoleId: reverting ================================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

ActiveRecord::IrreversibleMigration
/path/to/redmine/db/migrate/20090503121510_drop_members_role_id.rb:7:in `down'

journals

Committed the fix.
--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリCode cleanup/refactoring_30 にセット
  • 対象バージョン5.0.0_155 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0