2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

chat-spece DB設計

Posted at

README

DB設計図

group_users

Column Type Options
user_id integer null: false, foreign_key: true
group_id integer null: false, foreign_key: true

Association

  • belongs_to :group
  • belongs_to :user

groupsa

Column Type Options
name string null: false, default:

Association

  • has_many :messages
  • has_many :users, through: :group_users
  • has_many :group_users

messages

Column Type Options
body text
image string
user_id integer null: false, foreign_key: true, index: true
group_id integer null: false, foreign_key: true, index: true

Association

  • belongs_to :user
  • belongs_to :group

users

Column Type Options
name string null: false, default:
email string null: false, default:

Association

  • has_many :messages
  • add_index :users, :name, unique: true
  • add_index :users, :email, unique: true
  • has_many :groups, through: :group_users
  • has_many :group_users
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?