Add likes model, controller and tests

This commit is contained in:
riggraz
2019-09-27 12:32:30 +02:00
parent e1d8dbc281
commit 970cd6934c
13 changed files with 118 additions and 2 deletions

View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_09_18_151626) do
ActiveRecord::Schema.define(version: 2019_09_27_094233) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -36,6 +36,16 @@ ActiveRecord::Schema.define(version: 2019_09_18_151626) do
t.index ["user_id"], name: "index_comments_on_user_id"
end
create_table "likes", force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "post_id", null: false
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.index ["post_id"], name: "index_likes_on_post_id"
t.index ["user_id", "post_id"], name: "index_likes_on_user_id_and_post_id", unique: true
t.index ["user_id"], name: "index_likes_on_user_id"
end
create_table "post_statuses", force: :cascade do |t|
t.string "name", null: false
t.string "color", null: false
@@ -81,6 +91,8 @@ ActiveRecord::Schema.define(version: 2019_09_18_151626) do
add_foreign_key "comments", "comments", column: "parent_id"
add_foreign_key "comments", "posts"
add_foreign_key "comments", "users"
add_foreign_key "likes", "posts"
add_foreign_key "likes", "users"
add_foreign_key "posts", "boards"
add_foreign_key "posts", "post_statuses"
add_foreign_key "posts", "users"