aboutsummaryrefslogtreecommitdiffstats
path: root/db/migrate/20130226150829_create_favorites.rb
blob: c972b92403d2c52a36294f6893346f7f6cf6c6b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
class CreateFavorites < ActiveRecord::Migration
  def change
    create_table :favorites do |t|
      t.references :tweet, :limit => 8, :null => false
      t.references :user, :limit => 8, :null => false
    end

    add_index :favorites, [:tweet_id, :user_id], :unique => true
    add_index :favorites, :tweet_id
  end
end