Project

General

Profile

Refactor #28620

db:migrate fails with SQLite on Rails 6

Added by Anonymous 7 months ago. Updated 3 months ago.

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

Description

== 20140910153654 MoveHostNicsToInterfaces: migrating =========================
-- add_column(:nics, :primary, :boolean, {:default=>false})
   -> 0.0015s
-- add_column(:nics, :provision, :boolean, {:default=>false})
   -> 0.0012s
-- Migrating Host interfaces to standalone Interfaces
-- remove_column(:hosts, :ip)
   -> 0.0594s
-- remove_column(:hosts, :mac)
   -> 0.0626s
-- remove_column(:hosts, :primary_interface)
   -> 0.0668s
-- remove_foreign_key(:hosts, {:name=>"hosts_subnet_id_fk"})
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

Table 'hosts' has no foreign key for {}
/home/mmoll/mystuff/gitrepos/theforeman/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/connection_adapters/sqlite3/schema_statements.rb:75:in `remove_foreign_key'
/home/mmoll/mystuff/gitrepos/theforeman/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:890:in `block in method_missing'
/home/mmoll/mystuff/gitrepos/theforeman/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:858:in `block in say_with_time'
/home/mmoll/mystuff/gitrepos/theforeman/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:858:in `say_with_time'
/home/mmoll/mystuff/gitrepos/theforeman/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:879:in `method_missing'
/home/mmoll/mystuff/gitrepos/theforeman/foreman/db/migrate/20140910153654_move_host_nics_to_interfaces.rb:42:in `up'

Probably related to https://blog.bigbinary.com/2019/09/24/rails-6-adds-add_foreign_key-and-remove_foreign_key-for-sqlite3.html


Related issues

Blocks Foreman - Tracker #24837: Rails 6.0 TrackerClosed

Associated revisions

Revision a13f48bb (diff)
Added by Ondřej Ezr 4 months ago

Fixes #28620 - sqlite foreign_key removal

History

#1 Updated by Anonymous 7 months ago

#2 Updated by Tomer Brisker 5 months ago

  • Assignee set to Ondřej Ezr

#3 Updated by The Foreman Bot 5 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/7552 added

#4 Updated by Ondřej Ezr 4 months ago

  • Status changed from Ready For Testing to Closed

#5 Updated by Tomer Brisker 3 months ago

  • Fixed in Releases 2.1.0 added

Also available in: Atom PDF