Skip to content

Commit 17986cd

Browse files
committed
Add NewThreadFollower model
1 parent 9dce9b1 commit 17986cd

5 files changed

Lines changed: 42 additions & 1 deletion

File tree

app/models/new_thread_follower.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class NewThreadFollower < ApplicationRecord
2+
belongs_to :user
3+
belongs_to :post
4+
end
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class CreateNewThreadFollowers < ActiveRecord::Migration[7.2]
2+
def change
3+
create_table :new_thread_followers do |t|
4+
t.bigint :user_id
5+
t.bigint :post_id
6+
7+
t.timestamps
8+
end
9+
add_index :new_thread_followers, :user_id
10+
add_index :new_thread_followers, :post_id
11+
end
12+
end

db/schema.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[7.2].define(version: 2025_10_15_121326) do
13+
ActiveRecord::Schema[7.2].define(version: 2025_12_03_164131) do
1414
create_table "abilities", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
1515
t.bigint "community_id"
1616
t.string "name"
@@ -401,6 +401,15 @@
401401
t.index ["user_id"], name: "index_micro_auth_tokens_on_user_id"
402402
end
403403

404+
create_table "new_thread_followers", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
405+
t.bigint "user_id"
406+
t.bigint "post_id"
407+
t.datetime "created_at", null: false
408+
t.datetime "updated_at", null: false
409+
t.index ["post_id"], name: "index_new_thread_followers_on_post_id"
410+
t.index ["user_id"], name: "index_new_thread_followers_on_user_id"
411+
end
412+
404413
create_table "notifications", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
405414
t.text "content"
406415
t.string "link"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2+
3+
one:
4+
user_id:
5+
post_id:
6+
7+
two:
8+
user_id:
9+
post_id:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require "test_helper"
2+
3+
class NewThreadFollowerTest < ActiveSupport::TestCase
4+
# test "the truth" do
5+
# assert true
6+
# end
7+
end

0 commit comments

Comments
 (0)