Sha256: 97b178d6978f39421327ffd03ba83393342d072b0962212f1ded5b8ec1588e16
Contents?: true
Size: 695 Bytes
Versions: 47
Compression:
Stored size: 695 Bytes
Contents
class FixLookupKeyAuditableType < ActiveRecord::Migration[4.2] def up Audit.reorder(nil).joins('JOIN lookup_keys ON lookup_keys.id = audits.auditable_id') .where(auditable_type: 'LookupKey', lookup_keys: { type: 'VariableLookupKey' }) .update_all(auditable_type: 'VariableLookupKey') Audit.reorder(nil).joins('JOIN lookup_keys ON lookup_keys.id = audits.auditable_id') .where(auditable_type: 'LookupKey', lookup_keys: { type: 'PuppetclassLookupKey' }) .update_all(auditable_type: 'PuppetclassLookupKey') end def down Audit.where(auditable_type: %w[PuppetclassLookupKey VariableLookupKey]).update_all(auditable_type: 'LookupKey') end end
Version data entries
47 entries across 47 versions & 1 rubygems