Create model for ratings

This commit is contained in:
ricola 2025-04-06 17:04:31 -06:00
parent 6682c8c300
commit 4b5685124c
4 changed files with 44 additions and 2 deletions

View file

@ -0,0 +1,10 @@
class CreateRatings < ActiveRecord::Migration[7.2]
def change
create_table :ratings do |t|
t.belongs_to :user
t.belongs_to :candidate
t.integer :value
t.timestamps
end
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.2].define(version: 2025_03_21_234644) do
ActiveRecord::Schema[7.2].define(version: 2025_03_21_235135) do
create_table "candidates", force: :cascade do |t|
t.integer "vote_id"
t.string "name"
@ -20,6 +20,16 @@ ActiveRecord::Schema[7.2].define(version: 2025_03_21_234644) do
t.index ["vote_id"], name: "index_candidates_on_vote_id"
end
create_table "ratings", force: :cascade do |t|
t.integer "user_id"
t.integer "candidate_id"
t.integer "value"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["candidate_id"], name: "index_ratings_on_candidate_id"
t.index ["user_id"], name: "index_ratings_on_user_id"
end
create_table "users", force: :cascade do |t|
t.string "email"
t.string "password"