Sha256: b4e2ac7d769f63d4f08742957d8a6768ae919eff042b32ebfb61125d96cdf526

Contents?: true

Size: 404 Bytes

Versions: 11

Compression:

Stored size: 404 Bytes

Contents

class PopularMigration < ActiveRecord::Migration
  def up
    create_table :friendships do |t|

      t.references :popular_model, polymorphic: true
      t.references :friend, polymorphic: true

      t.timestamps
    end

    add_index :friendships, [:popular_model_id, :popular_model_type]
    add_index :friendships, [:friend_id, :friend_type]
  end

  def down
    drop_table :friendships
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
popular-0.7.4 lib/generators/popular/migration/templates/active_record/migration.rb
popular-0.7.3 lib/generators/popular/migration/templates/active_record/migration.rb
popular-0.7.2 lib/generators/popular/migration/templates/active_record/migration.rb
popular-0.7.1 lib/generators/popular/migration/templates/active_record/migration.rb
popular-0.7.0 lib/generators/popular/migration/templates/active_record/migration.rb
popular-0.6.0 lib/generators/popular/migration/templates/active_record/migration.rb
popular-0.5.1 lib/generators/popular/migration/templates/active_record/migration.rb
popular-0.5.0 lib/generators/popular/migration/templates/active_record/migration.rb
popular-0.4.0 lib/generators/popular/migration/templates/active_record/migration.rb
popular-0.3.2 lib/generators/popular/migration/templates/active_record/migration.rb
popular-0.3.1 lib/generators/popular/migration/templates/active_record/migration.rb