Sha256: b74d340b51ae39528938d78f4dc07d79ea4c3723555f30cfad57604031e7a0f1

Contents?: true

Size: 616 Bytes

Versions: 2

Compression:

Stored size: 616 Bytes

Contents

class AddFollowsMigration < ActiveRecord::Migration
  def up
    create_table :follows do |t|
      t.references :followable, polymorphic: true
      t.references :follower, polymorphic: true

      t.timestamps null: false
    end

    add_index :follows, ['follower_id', 'follower_type'], name: 'index_partisan_followers'
    add_index :follows, ['followable_id', 'followable_type'], name: 'index_partisan_followables'
    add_index :follows, ['follower_id', 'follower_type', 'followable_id', 'follower_type'], name: 'index_partisan_unique_follow', unique: true
  end

  def down
    drop_table :follows
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
partisan-0.5 lib/generators/partisan/templates/migration.rb
partisan-0.4.2 lib/generators/partisan/templates/migration.rb