Sha256: 8f8945e766bd2bdc372c609540745e44a0a1d108d3b2d550e19b729e09e56bb1

Contents?: true

Size: 618 Bytes

Versions: 1

Compression:

Stored size: 618 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', 'followable_type'], name: 'index_partisan_unique_follow', unique: true
  end

  def down
    drop_table :follows
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
partisan-0.5.1 lib/generators/partisan/templates/migration.rb