Chat

Tables (4)

Message

  • messageId — Integer — Primary key — NOT NULL
  • content — text — NOT NULL
  • created_at — Timestamp
  • roomId — Integer — Foreign key → Room.roomId — NOT NULL — serial
  • userId — Integer — Foreign key → User.userId — NOT NULL — serial

Room

  • roomId — Integer — Primary key — NOT NULL — serial
  • name — string
  • is_group — boolean — NOT NULL
  • created_at — timestamp — NOT NULL

RoomUser

  • userId — Integer — Foreign key → User.userId — NOT NULL — serial
  • roomId — Integer — Foreign key → Room.roomId — NOT NULL — serial
  • joined_at — timestamp — NOT NULL

User

  • userId — Integer — Primary key — NOT NULL — serial
  • username — varchar — NOT NULL — unique
  • email — varchar — NOT NULL — unique
  • password_hash — varchar — NOT NULL
  • created_at — timestamp with time zone
  • last_login — timestamp with time zone