Make Reaction polymorphic

Add migration to replace comment_id with polymorphic reactable
association (reactable_type, reactable_id), enabling reactions on both
comments and cards.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Mike Dalessio
2026-01-21 11:26:03 -05:00
parent 49f45b6645
commit 1570c16f67
3 changed files with 35 additions and 6 deletions
Generated
+4 -3
View File
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.2].define(version: 2025_12_24_092315) do
ActiveRecord::Schema[8.2].define(version: 2026_01_21_155752) do
create_table "accesses", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.datetime "accessed_at"
t.uuid "account_id", null: false
@@ -412,13 +412,14 @@ ActiveRecord::Schema[8.2].define(version: 2025_12_24_092315) do
create_table "reactions", id: :uuid, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.uuid "account_id", null: false
t.uuid "comment_id", null: false
t.string "content", limit: 16, null: false
t.datetime "created_at", null: false
t.uuid "reactable_id", null: false
t.string "reactable_type", null: false
t.uuid "reacter_id", null: false
t.datetime "updated_at", null: false
t.index ["account_id"], name: "index_reactions_on_account_id"
t.index ["comment_id"], name: "index_reactions_on_comment_id"
t.index ["reactable_type", "reactable_id"], name: "index_reactions_on_reactable_type_and_reactable_id"
t.index ["reacter_id"], name: "index_reactions_on_reacter_id"
end