From 4103861f9088d5d5131ec4961edbd1d00ca595cf Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Mon, 27 Aug 2018 12:59:22 +0200 Subject: [PATCH] Add the rating column to feedbacks --- app/models/feedback.rb | 6 ++++++ db/migrate/20180827102828_add_rating_to_feedbacks.rb | 5 +++++ db/schema.rb | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20180827102828_add_rating_to_feedbacks.rb diff --git a/app/models/feedback.rb b/app/models/feedback.rb index 63affddde..d697541d9 100644 --- a/app/models/feedback.rb +++ b/app/models/feedback.rb @@ -1,3 +1,9 @@ class Feedback < ApplicationRecord belongs_to :user + + enum rating: { + happy: 'happy', + neutral: 'neutral', + unhappy: 'unhappy' + } end diff --git a/db/migrate/20180827102828_add_rating_to_feedbacks.rb b/db/migrate/20180827102828_add_rating_to_feedbacks.rb new file mode 100644 index 000000000..cc3c0c97d --- /dev/null +++ b/db/migrate/20180827102828_add_rating_to_feedbacks.rb @@ -0,0 +1,5 @@ +class AddRatingToFeedbacks < ActiveRecord::Migration[5.2] + def change + add_column :feedbacks, :rating, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 492fe9f51..f3ed94862 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2018_08_22_162952) do +ActiveRecord::Schema.define(version: 2018_08_27_102828) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -323,6 +323,7 @@ ActiveRecord::Schema.define(version: 2018_08_22_162952) do t.integer "mark" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.string "rating" t.index ["user_id"], name: "index_feedbacks_on_user_id" end