Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- users
- id: int // users has_many chat_users
- chats
- id: int // chats has_many chat_users
- chat_users
- id: int
- chat_id: int (foreign key) // chat_users belongs_to chat
- user_id: int (foreign key) // chat_users belongs_to user
- users, id: 1
- users, id: 2
- chats, id: 1 // <---------
- chats, id: 2
- chat_users, id: 1, chat_id: 1, user_id: 1 // <-------
- chat_users, id: 2, chat_id: 1, user_id: 2 // <-------
- chat_users, id: 3, chat_id: 2, user_id: 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement