Project

General

Profile

Bug #12199

Rails 4 migration errors

Added by John Mitsch over 6 years ago. Updated over 4 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

on rails4_from_scratch branch (on elobato's fork) we are seeing errors when running migrations like https://gist.github.com/eLobato/0f5db50b5c93cc6c277c

Associated revisions

Revision fb9f45e8 (diff)
Added by Daniel Lobato Garcia about 6 years ago

Fixes #7230, #12021 - Upgrade to Rails 4.1.5

This commits upgrades Rails to Rails 4.1.5. See a description of the
changes included here, and go to the pull request in GitHub to see more
detailed explanations:

  • Update gems to a Rails 4 compatible version, including dependencies
  • Fix counter cache columns
  • Remove conditions, order, limit from has_many relations
  • Remove test runner
    On minitest 5, the runner API was deprecated, so our custom test
    runner is no longer working.
  • Remove useless add_index on lookup_values match
    An index is added previously on lookup_values :priority, and on Rails 4
    rename_column changes 'priority' to 'match' already changes the name of
    the index.
  • Alias assert_include to assert_includes.
  • Expire topbar cache
  • Subclass ApplicationMailer in test to avoid 'missing template' error
  • Fixes #12021 - Use .to_param to find parent object in LookupKeys controller
    On Rails 4, .find will not default to .friendly.find so find_hostgroup,
    find_environment and find_host will fail for non numeric IDs. However, we can
    use from_param to find these objects. This is something we can do both on
    Rails 3 and Rails 4, whereas using .friendly isn't an option until friendly_id
    5.0, which depends on Rails 4.
  • Use explicit friendly ID search.
  • find_common finder uses from_param -> friendly -> find
    The finder needed to be refactored because with the new Friendly ID we
    have to use .friendly explicitely. It currently follows the strategy of
    searching like this:
    - from_param -> .friendly -> regular find
  • Remove RecordNotFound errors from parameterizable in rails 4
  • Protect attributes using attr_accessible and protected_attributes
  • url_for doesn't append port when protocol is specified
    Some of our tests are checking if port 80 or 443 is included in the URL
    generated by lib/foreman/renderer.rb. However url_for has changed in
    Rails 4 and now it does not append the port even if explicitly added.

    If the protocol is specified, as it is in this case, then the url
    generated will just have the protocol (http or https) but not the port
    (80 or 443)

  • Validate object instead of _id column in join tables
    On Rails 4 such validations will fail when we try to create objects
    without explicitely assigning the id.
    Puppetclass.new(:config_group => config_group) would fail even for a
    valid config group, :config_group_id => config_group.id should be used
    instead.

    To avoid that, we validate the object, not the ID column

  • Rails 4 non backwards compatible syntax changes
    Changes that have to deal with how some of the internal Rails objects
    need a new syntax, like generating routes, exceptions, form builders.
    None of these are Rails 3 compatible.
  • Refactor fact value test to not modify user_roles directly
  • Return external usergroupsas an array
  • Use eager_load to preload associations to be used in where

Fixes #7230, #12021 - Upgrade to Rails 4.1.5

This commits upgrades Rails to Rails 4.1.5. See a description of the
changes included here, and go to the pull request in GitHub to see more
detailed explanations:

  • Update gems to a Rails 4 compatible version, including dependencies
  • Fix counter cache columns
  • Remove conditions, order, limit from has_many relations
  • Remove test runner
    On minitest 5, the runner API was deprecated, so our custom test
    runner is no longer working.
  • Remove useless add_index on lookup_values match
    An index is added previously on lookup_values :priority, and on Rails 4
    rename_column changes 'priority' to 'match' already changes the name of
    the index.
  • Alias assert_include to assert_includes.
  • Expire topbar cache
  • Subclass ApplicationMailer in test to avoid 'missing template' error
  • Fixes #12021 - Use .to_param to find parent object in LookupKeys controller
    On Rails 4, .find will not default to .friendly.find so find_hostgroup,
    find_environment and find_host will fail for non numeric IDs. However, we can
    use from_param to find these objects. This is something we can do both on
    Rails 3 and Rails 4, whereas using .friendly isn't an option until friendly_id
    5.0, which depends on Rails 4.
  • Use explicit friendly ID search.
  • find_common finder uses from_param -> friendly -> find
    The finder needed to be refactored because with the new Friendly ID we
    have to use .friendly explicitely. It currently follows the strategy of
    searching like this:
    - from_param -> .friendly -> regular find
  • Remove RecordNotFound errors from parameterizable in rails 4
  • Protect attributes using attr_accessible and protected_attributes
  • url_for doesn't append port when protocol is specified
    Some of our tests are checking if port 80 or 443 is included in the URL
    generated by lib/foreman/renderer.rb. However url_for has changed in
    Rails 4 and now it does not append the port even if explicitly added.

    If the protocol is specified, as it is in this case, then the url
    generated will just have the protocol (http or https) but not the port
    (80 or 443)

  • Validate object instead of _id column in join tables
    On Rails 4 such validations will fail when we try to create objects
    without explicitely assigning the id.
    Puppetclass.new(:config_group => config_group) would fail even for a
    valid config group, :config_group_id => config_group.id should be used
    instead.

    To avoid that, we validate the object, not the ID column

  • Rails 4 non backwards compatible syntax changes
    Changes that have to deal with how some of the internal Rails objects
    need a new syntax, like generating routes, exceptions, form builders.
    None of these are Rails 3 compatible.
  • Refactor fact value test to not modify user_roles directly
  • Return external usergroupsas an array
  • Use eager_load to preload associations to be used in where
  • Auto detect jenkins rake task in application.rb and set test RAILS_ENV
    in that case
  • Reference previously undigested assets in CSS and js as digested using
    asset-url or image-url
  • Adapted sprockets manifest.json instead of manifest.yml (ehelms)

History

#1 Updated by Dominic Cleal over 6 years ago

  • Status changed from New to Feedback

The URL doesn't work, please put errors in the description or attach them. Filing issues against Foreman for a developer's branch probably won't get them fixed, so please contact the developer directly or use the mailing list.

#2 Updated by Anonymous over 4 years ago

  • Status changed from Feedback to Rejected

Also available in: Atom PDF