Sha256: e13ed328d6a360c524406647a1715e55d9ecd186884040dfdd0ee05f4ad41028

Contents?: true

Size: 857 Bytes

Versions: 6

Compression:

Stored size: 857 Bytes

Contents

# This migration and AddTransactionIdColumnToVersions provide the necessary
# schema for tracking associations.
class AddForeignTypeToVersionAssociations < ActiveRecord::Migration<%= migration_version %>
  def self.up
    add_column :version_associations, :foreign_type, :string, index: true
    remove_index :version_associations,
      name: "index_version_associations_on_foreign_key"
    add_index :version_associations,
      %i(foreign_key_name foreign_key_id foreign_type),
      name: "index_version_associations_on_foreign_key"
  end

  def self.down
    remove_index :version_associations,
      name: "index_version_associations_on_foreign_key"
    remove_column :version_associations, :foreign_type
    add_index :version_associations,
      %i(foreign_key_name foreign_key_id),
      name: "index_version_associations_on_foreign_key"
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/paper_trail-association_tracking-2.2.1/lib/generators/paper_trail_association_tracking/templates/add_foreign_type_to_version_associations.rb.erb
paper_trail-association_tracking-2.2.1 lib/generators/paper_trail_association_tracking/templates/add_foreign_type_to_version_associations.rb.erb
paper_trail-association_tracking-2.2.0 lib/generators/paper_trail_association_tracking/templates/add_foreign_type_to_version_associations.rb.erb
paper_trail-association_tracking-2.1.3 lib/generators/paper_trail_association_tracking/templates/add_foreign_type_to_version_associations.rb.erb
paper_trail-association_tracking-2.1.1 lib/generators/paper_trail_association_tracking/templates/add_foreign_type_to_version_associations.rb.erb
paper_trail-association_tracking-2.1.0 lib/generators/paper_trail_association_tracking/templates/add_foreign_type_to_version_associations.rb.erb