Columns
| Column | Type | Size | Nulls | Auto | Default | Children | Parents | Comments | |||
|---|---|---|---|---|---|---|---|---|---|---|---|
| box_id | uuid | 2147483647 | null |
|
|
Обмен (FK на boxes) |
|||||
| draw_id | uuid | 2147483647 | null |
|
|
Жеребьевка (FK на draw_results) |
|||||
| participant1_id | uuid | 2147483647 | null |
|
|
Первый участник (FK на box_participants) |
|||||
| participant2_id | uuid | 2147483647 | null |
|
|
Второй участник (FK на box_participants) |
|||||
| is_active | bool | 1 | null |
|
|
Флаг активности чата |
|||||
| id | uuid | 2147483647 | null |
|
|
Уникальный идентификатор чата (UUID) |
|||||
| created_at | timestamptz | 35,6 | now() |
|
|
Дата создания чата |
|||||
| updated_at | timestamptz | 35,6 | now() |
|
|
Дата последнего сообщения |
Indexes
| Constraint Name | Type | Sort | Column(s) |
|---|---|---|---|
| chat_rooms_pkey | Primary key | Asc | id |
| ix_chat_rooms_box_id | Performance | Asc | box_id |
| ix_chat_rooms_draw_id | Performance | Asc | draw_id |
| ix_chat_rooms_is_active | Performance | Asc | is_active |
| ix_chat_rooms_participant1_id | Performance | Asc | participant1_id |
| ix_chat_rooms_participant2_id | Performance | Asc | participant2_id |
| uq_chat_rooms_participants | Must be unique | Asc/Asc/Asc | draw_id + participant1_id + participant2_id |
Check Constraints
| Constraint Name | Constraint |
|---|---|
| chk_chat_participants_different | (participant1_id <> participant2_id) |
| chk_chat_participants_order | (participant1_id < participant2_id) |

