Skip to content

Commit

Permalink
Missing cascade delete for host_storages
Browse files Browse the repository at this point in the history
Missing cascade delete for host_storages, leading to orphaned
records.

Fixes BZ:
https://bugzilla.redhat.com/show_bug.cgi?id=1508910
  • Loading branch information
Ladas committed Nov 10, 2017
1 parent c8e9b92 commit 85c0224
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Host < ApplicationRecord
has_many :vms_and_templates, :dependent => :nullify
has_many :vms, :inverse_of => :host
has_many :miq_templates, :inverse_of => :host
has_many :host_storages
has_many :host_storages, :dependent => :destroy
has_many :storages, :through => :host_storages
has_many :host_switches, :dependent => :destroy
has_many :switches, :through => :host_switches
Expand Down
2 changes: 1 addition & 1 deletion app/models/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Storage < ApplicationRecord
has_many :vms_and_templates, :foreign_key => :storage_id, :dependent => :nullify, :class_name => "VmOrTemplate"
has_many :miq_templates, :foreign_key => :storage_id
has_many :vms, :foreign_key => :storage_id
has_many :host_storages
has_many :host_storages, :dependent => :destroy
has_many :hosts, :through => :host_storages
has_many :storage_profile_storages, :dependent => :destroy
has_many :storage_profiles, :through => :storage_profile_storages
Expand Down

0 comments on commit 85c0224

Please sign in to comment.