Columns
| Column | Type | Size | Nulls | Auto | Default | Children | Parents | Comments | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| team_id | uuid | 2147483647 | null |
|
|
Команда владельца (FK на teams) |
|||||||||||||||||
| name | text | 2147483647 | null |
|
|
Название обмена |
|||||||||||||||||
| description | text | 2147483647 | √ | null |
|
|
Описание обмена |
||||||||||||||||
| budget_min | numeric | 10,2 | √ | null |
|
|
Минимальный бюджет (NUMERIC 10,2) |
||||||||||||||||
| budget_max | numeric | 10,2 | √ | null |
|
|
Максимальный бюджет (NUMERIC 10,2) |
||||||||||||||||
| currency | text | 2147483647 | null |
|
|
Валюта бюджета (RUB, USD, EUR) |
|||||||||||||||||
| start_date | timestamptz | 35,6 | null |
|
|
Дата начала обмена |
|||||||||||||||||
| draw_date | timestamptz | 35,6 | √ | null |
|
|
Дата проведения жеребьевки |
||||||||||||||||
| delivery_deadline | timestamptz | 35,6 | √ | null |
|
|
Дедлайн доставки подарка |
||||||||||||||||
| status | text | 2147483647 | null |
|
|
Статус обмена (FK на box_statuses) |
|||||||||||||||||
| is_public_within_team | bool | 1 | null |
|
|
Флаг публичности в команде |
|||||||||||||||||
| allow_exclusions | bool | 1 | null |
|
|
Разрешить исключения кто-кому-не-дарит |
|||||||||||||||||
| max_wishlist_items | int4 | 10 | 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) |
|---|---|---|---|
| boxes_pkey | Primary key | Asc | id |
| ix_boxes_draw_date | Performance | Asc | draw_date |
| ix_boxes_start_date | Performance | Asc | start_date |
| ix_boxes_status | Performance | Asc | status |
| ix_boxes_team_id | Performance | Asc | team_id |
Check Constraints
| Constraint Name | Constraint |
|---|---|
| chk_boxes_dates | ((draw_date IS NULL) OR (start_date IS NULL) OR (draw_date >= start_date)) |
| chk_boxes_max_items | ((max_wishlist_items > 0) AND (max_wishlist_items <= 100)) |
| chk_boxes_budget_positive | ((budget_min IS NULL) OR (budget_min >= (0)::numeric)) |
| chk_boxes_name_length | ((char_length(name) >= 2) AND (char_length(name) <= 200)) |
| chk_boxes_budget | ((budget_min IS NULL) OR (budget_max IS NULL) OR (budget_min <= budget_max)) |
| chk_boxes_delivery_deadline | ((delivery_deadline IS NULL) OR (draw_date IS NULL) OR (delivery_deadline >= draw_date)) |

