Project

General

Profile

« Previous | Next » 

Revision 596ec5dc

Added by Marek Hulán about 6 years ago

Refs #22984 - fix the type for all templates

View differences:

db/migrate/20180601102951_fix_all_templates_auditable_type.rb
class FixAllTemplatesAuditableType < ActiveRecord::Migration[5.1]
def up
Audit.unscoped.where(:auditable_type => 'Template', :auditable_id => ProvisioningTemplate.unscoped.pluck(:id)).update_all(:auditable_type => 'ProvisioningTemplate')
Audit.unscoped.where(:auditable_type => 'Template', :auditable_id => Ptable.unscoped.pluck(:id)).update_all(:auditable_type => 'Ptable')
end
def down
Audit.unscoped.where(:auditable_type => ['Ptable', 'ProvisioningTemplate']).update_all(:auditable_type => 'Template')
end
end

Also available in: Unified diff