mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Create UserChatThreadMembership table and model (#21481)
This will enable us to begin work on user tracking state for a thread so we can show thread-specific unreads and mentions indicators. In this case are following the core notification_level paradigm rather than the solution UserChatChannelMembership went with, and eventually we will want to refactor the other table to match this as well. Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddUserChatThreadMemberships < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
create_table :user_chat_thread_memberships do |t|
|
||||
t.bigint :user_id, null: false
|
||||
t.bigint :thread_id, null: false
|
||||
t.bigint :last_read_message_id
|
||||
t.integer :notification_level, default: 2, null: false # default to tracking
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :user_chat_thread_memberships,
|
||||
%i[user_id thread_id],
|
||||
unique: true,
|
||||
name: "user_chat_thread_unique_memberships"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user