Project

General

Profile

« Previous | Next » 

Revision 8c3d16e0

Added by Ondřej Ezr over 2 years ago

Fixes #31060 - drop Environments migrations

Drops all migrations related to environments.
Removes all the relations to the environments.
Adds a migration to drop environments from Hostgroup and Host.

Extracted in https://github.com/theforeman/foreman_puppet_enc/pull/41.

View differences:

db/migrate/20130908100439_delete_orphaned_records.rb
OsDefaultTemplate.where("config_template_id NOT IN (?)", FakeConfigTemplate.unscoped.pluck(:id)).update_all(:config_template_id => nil)
OsDefaultTemplate.where("operatingsystem_id NOT IN (?)", Operatingsystem.unscoped.pluck(:id)).update_all(:operatingsystem_id => nil)
OsDefaultTemplate.where("template_kind_id NOT IN (?)", TemplateKind.unscoped.pluck(:id)).update_all(:template_kind_id => nil)
TemplateCombination.where("config_template_id NOT IN (?)", FakeConfigTemplate.unscoped.pluck(:id)).update_all(:config_template_id => nil)
TemplateCombination.where("hostgroup_id NOT IN (?)", Hostgroup.unscoped.pluck(:id)).update_all(:hostgroup_id => nil)
host_groups_up
hosts_up

Also available in: Unified diff