Sha256: de339742ca5260ea2dd2e232910f35037050afb2078902dd943a13d6abf45edf

Contents?: true

Size: 823 Bytes

Versions: 7

Compression:

Stored size: 823 Bytes

Contents

# This migration and AddTransactionIdColumnToVersions provide the necessary
# schema for tracking associations.
class CreateVersionAssociations < ActiveRecord::Migration<%= migration_version %>
  def self.up
    create_table :version_associations do |t|
      t.integer  :version_id
      t.string   :foreign_key_name, null: false
      t.integer  :foreign_key_id
      t.string   :foreign_type
    end
    add_index :version_associations, [:version_id]
    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, [:version_id]
    remove_index :version_associations,
      name: "index_version_associations_on_foreign_key"
    drop_table :version_associations
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
paper_trail-association_tracking-2.2.1 lib/generators/paper_trail_association_tracking/templates/create_version_associations.rb.erb
paper_trail-association_tracking-2.2.0 lib/generators/paper_trail_association_tracking/templates/create_version_associations.rb.erb
paper_trail-association_tracking-2.1.3 lib/generators/paper_trail_association_tracking/templates/create_version_associations.rb.erb
paper_trail-association_tracking-2.1.1 lib/generators/paper_trail_association_tracking/templates/create_version_associations.rb.erb
paper_trail-association_tracking-2.1.0 lib/generators/paper_trail_association_tracking/templates/create_version_associations.rb.erb
paper_trail-association_tracking-2.0.0 lib/generators/paper_trail_association_tracking/templates/create_version_associations.rb.erb
paper_trail-association_tracking-1.1.1 lib/generators/paper_trail_association_tracking/templates/create_version_associations.rb.erb