Project

General

Profile

Actions

Bug #16194

closed

remove_foreign_key called from RemoveAuditUserFk with wrong table name

Added by Dominic Cleal over 7 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
DB migrations
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

The 20141120140051 RemoveAuditUserFk database migration calls remove_foreign_key with the table name user rather than users. On Rails 4.2 this seems to work, but under Rails 5.0, it raises an error:

    == 20141120140051 RemoveAuditUserFk: migrating ================================
    -- remove_foreign_key(:audits, :user)
    rake aborted!
    StandardError: An error has occurred, all later migrations canceled:

    Table 'audits' has no foreign key for user
    activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:970:in `foreign_key_for!'
    activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:940:in `remove_foreign_key'

Docs seem to suggest it must be the table name, which is plural: http://apidock.com/rails/ActiveRecord/ConnectionAdapters/SchemaStatements/remove_foreign_key

Actions #1

Updated by The Foreman Bot over 7 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3747 added
Actions #2

Updated by Dominic Cleal over 7 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #3

Updated by Dominic Cleal over 7 years ago

  • translation missing: en.field_release set to 160
Actions

Also available in: Atom PDF