Sha256: 6dc36334a1d87d1b5bcd9ae996fab4b340fee44829d8f4746515e0a3d15147b5

Contents?: true

Size: 418 Bytes

Versions: 2

Compression:

Stored size: 418 Bytes

Contents

# Encoding: utf-8
class ActsAsStarrableMigration < ActiveRecord::Migration
  def self.up
    create_table :ratings do |t|
      t.belongs_to :starrable, :polymorphic => true
      t.belongs_to :rater, :polymorphic => true
      t.integer :rating
    end

    add_index :ratings, [:starrable_id, :starrable_type]
    add_index :ratings, [:rater_id, :rater_type]
  end

  def self.down
    drop_table :ratings
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
acts_as_starrable-0.0.2 lib/generators/acts_as_starrable/migration/templates/active_record/migration.rb
acts_as_starrable-0.0.1 lib/generators/acts_as_starrable/migration/templates/active_record/migration.rb