Sha256: 29157eb25cfbbf5ed6a8f4616e9e5779382beea8f727d81afa377d6efdfde9a5

Contents?: true

Size: 810 Bytes

Versions: 3

Compression:

Stored size: 810 Bytes

Contents

class AddEmotions < ActiveRecord::Migration
  def up
    create_table :emotions do |t|
      # The emotional model
      t.string :emotional_type
      t.integer :emotional_id

      # The emotive model
      t.string :emotive_type
      t.integer :emotive_id

      # The type of emotion
      t.string :emotion

      t.timestamps
    end

    add_index :emotions, [:emotional_type, :emotional_id, :emotive_type, :emotive_id, :emotion], unique: true, name: 'index_emotions_by_emotional_emotive_and_emotion'
    add_index :emotions, [:emotional_type, :emotional_id, :emotive_type, :emotive_id], name: 'index_emotions_by_emotional_and_emotive'
    add_index :emotions, [:emotive_type, :emotive_id, :emotion], name: 'index_emotions_by_emotional_and_emotive'
  end

  def down
    drop_table :emotions
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
emotions-0.1.2 lib/generators/emotions/templates/migration.rb
emotions-0.1.1 lib/generators/emotions/templates/migration.rb
emotions-0.1 lib/generators/emotions/templates/migration.rb