Sha256: 69b3bae5c595a74a6dc6591d8a5050b23630d039fb3fe95e476ad1cceb4d89f0

Contents?: true

Size: 1.52 KB

Versions: 2

Compression:

Stored size: 1.52 KB

Contents

class CreateFlexibleFeedsEvents < ActiveRecord::Migration
  def change
    create_table :flexible_feeds_events do |t|
      t.string :eventable_type
      t.integer :eventable_id
      t.integer :creator_id
      t.string :creator_type

      t.integer :parent_id
      t.string :parent_type
      t.integer :ancestor_id
      t.string :ancestor_type
      t.integer :children_count, null: false, default: 0
      
      t.integer :votes_sum, null: false, default: 0
      t.integer :votes_for, null: false, default: 0
      t.integer :votes_against, null: false, default: 0
      t.float :controversy, null: false, default: 0, precision: 5, scale: 2
      t.float :popularity, null: false, default: 0, precision: 5, scale: 2

      t.timestamps
    end

    add_index :flexible_feeds_events, :votes_sum
    add_index :flexible_feeds_events, :votes_for
    add_index :flexible_feeds_events, :votes_against
    add_index :flexible_feeds_events, :controversy
    add_index :flexible_feeds_events, :popularity
    add_index :flexible_feeds_events, :children_count
    add_index :flexible_feeds_events,
      [:eventable_id, :eventable_type],
      name: "flexible_feeds_events_on_eventable"
    add_index :flexible_feeds_events,
      [:creator_id, :creator_type],
      name: "flexible_feeds_events_on_creator"
    add_index :flexible_feeds_events,
      [:parent_id, :parent_type],
      name: "flexible_feeds_events_on_parent"
    add_index :flexible_feeds_events,
      [:ancestor_id, :ancestor_type],
      name: "flexible_feeds_events_on_ancestor"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flexible_feeds-0.2.1 db/migrate/20140227194816_create_flexible_feeds_events.rb
flexible_feeds-0.1.0 db/migrate/20140227194816_create_flexible_feeds_events.rb