Skip to content

Instantly share code, notes, and snippets.

@CarlosEspejo
Created December 7, 2012 21:26
Show Gist options
  • Save CarlosEspejo/4236663 to your computer and use it in GitHub Desktop.
Save CarlosEspejo/4236663 to your computer and use it in GitHub Desktop.
indexing needed?
class CreateListProductInteractions < ActiveRecord::Migration
def change
create_table :list_product_interactions do |t|
t.integer :votes_up, default: 0
t.integer :votes_down, default: 0
t.integer :votes_activity, default: 0
t.integer :votes_total, default: 0
t.integer :list_id
t.integer :product_id
t.timestamps
end
end
end
class CreateVotes < ActiveRecord::Migration
def change
create_table :votes do |t|
t.string :status
t.boolean :vote_up
t.boolean :vote_down
t.integer :user_id
t.timestamps
end
add_index :votes, :user_id
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment