Class: CreateSharpSocial

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/sharp_social/templates/migration.rb

Overview

Migration responsible for creating a table with activities

Class Method Summary collapse

Class Method Details

.downObject



16
17
18
# File 'lib/generators/sharp_social/templates/migration.rb', line 16

def self.down
  drop_table :follows
end

.upObject

Create table



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/sharp_social/templates/migration.rb', line 4

def self.up
  create_table :follows, :force => true do |t|
    t.references :actor, :polymorphic => true, :null => false
    t.references :follower, :polymorphic => true, :null => false
    t.boolean :blocked, :default => false, :null => false
    t.timestamps
  end

  add_index :follows, ["actor_id", "actor_type"]
  add_index :follows, ["follower_id", "follower_type"]
end