diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-14 11:12:05 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-14 11:12:05 -0400 |
commit | fce622b5b1959892b6f6ea94bfe3a1c4eb52d8dd (patch) | |
tree | 27d42a442c000781d100dfa7fd8b976aefb03c31 /db | |
parent | 0aace2986a9a7a6d4c84a9ba6819d3df7821e267 (diff) | |
download | thoughts-fce622b5b1959892b6f6ea94bfe3a1c4eb52d8dd.tar.gz thoughts-fce622b5b1959892b6f6ea94bfe3a1c4eb52d8dd.tar.bz2 thoughts-fce622b5b1959892b6f6ea94bfe3a1c4eb52d8dd.zip |
Added comment replying
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20231014141657_add_reply_to_comment.rb | 5 | ||||
-rw-r--r-- | db/schema.rb | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/db/migrate/20231014141657_add_reply_to_comment.rb b/db/migrate/20231014141657_add_reply_to_comment.rb new file mode 100644 index 0000000..8e7b445 --- /dev/null +++ b/db/migrate/20231014141657_add_reply_to_comment.rb | |||
@@ -0,0 +1,5 @@ | |||
1 | class AddReplyToComment < ActiveRecord::Migration[7.0] | ||
2 | def change | ||
3 | add_reference :comments, :reply_to, foreign_key: { to_table: :comments } | ||
4 | end | ||
5 | end | ||
diff --git a/db/schema.rb b/db/schema.rb index 56fd9bb..49c7925 100644 --- a/db/schema.rb +++ b/db/schema.rb | |||
@@ -10,7 +10,7 @@ | |||
10 | # | 10 | # |
11 | # It's strongly recommended that you check this file into your version control system. | 11 | # It's strongly recommended that you check this file into your version control system. |
12 | 12 | ||
13 | ActiveRecord::Schema[7.0].define(version: 2023_10_14_140431) do | 13 | ActiveRecord::Schema[7.0].define(version: 2023_10_14_141657) do |
14 | create_table "audits", force: :cascade do |t| | 14 | create_table "audits", force: :cascade do |t| |
15 | t.integer "auditable_id" | 15 | t.integer "auditable_id" |
16 | t.string "auditable_type" | 16 | t.string "auditable_type" |
@@ -68,7 +68,9 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_14_140431) do | |||
68 | t.datetime "published_at" | 68 | t.datetime "published_at" |
69 | t.datetime "created_at", null: false | 69 | t.datetime "created_at", null: false |
70 | t.datetime "updated_at", null: false | 70 | t.datetime "updated_at", null: false |
71 | t.integer "reply_to_id" | ||
71 | t.index ["blog_id"], name: "index_comments_on_blog_id" | 72 | t.index ["blog_id"], name: "index_comments_on_blog_id" |
73 | t.index ["reply_to_id"], name: "index_comments_on_reply_to_id" | ||
72 | end | 74 | end |
73 | 75 | ||
74 | create_table "games", force: :cascade do |t| | 76 | create_table "games", force: :cascade do |t| |
@@ -362,6 +364,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_14_140431) do | |||
362 | 364 | ||
363 | add_foreign_key "blogs", "users" | 365 | add_foreign_key "blogs", "users" |
364 | add_foreign_key "comments", "blogs" | 366 | add_foreign_key "comments", "blogs" |
367 | add_foreign_key "comments", "comments", column: "reply_to_id" | ||
365 | add_foreign_key "pokeviewer_items", "pokeviewer_moves", column: "move_id" | 368 | add_foreign_key "pokeviewer_items", "pokeviewer_moves", column: "move_id" |
366 | add_foreign_key "pokeviewer_pokedex_entries", "pokeviewer_species", column: "species_id" | 369 | add_foreign_key "pokeviewer_pokedex_entries", "pokeviewer_species", column: "species_id" |
367 | add_foreign_key "pokeviewer_pokedex_entries", "pokeviewer_trainers", column: "trainer_id" | 370 | add_foreign_key "pokeviewer_pokedex_entries", "pokeviewer_trainers", column: "trainer_id" |