<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<database name="secretio" schema="public" type="PostgreSQL - 18.1 (Debian 18.1-1.pgdg13+2)">
   <tables>
      <table name="analytics_events" numRows="265" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="session_id" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="event_type" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="event_data" nullable="false" remarks="" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="ip_hash" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="analytics_events_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_analytics_created_at" unique="false">
            <column ascending="true" name="created_at"/>
         </index>
         <index name="ix_analytics_event_data" unique="false">
            <column ascending="true" name="event_data"/>
         </index>
         <index name="ix_analytics_events_event_type" unique="false">
            <column ascending="true" name="event_type"/>
         </index>
         <index name="ix_analytics_events_ip_hash" unique="false">
            <column ascending="true" name="ip_hash"/>
         </index>
         <index name="ix_analytics_events_session_id" unique="false">
            <column ascending="true" name="session_id"/>
         </index>
      </table>
      <table name="anonymous_hints" remarks="Анонимные вопросы друзей по конкретным пунктам вишлиста" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="sender_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="anonymous_hints_sender_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="receiver_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="anonymous_hints_receiver_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="wishlist_item_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="anonymous_hints_wishlist_item_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="wishlist_items"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="question_text" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="answer_text" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="true" digits="0" id="6" name="is_anonymous" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="8" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="anonymous_hints_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="idx_anon_hints_item" unique="false">
            <column ascending="true" name="wishlist_item_id"/>
         </index>
         <index name="idx_anon_hints_receiver" unique="false">
            <column ascending="true" name="receiver_id"/>
         </index>
      </table>
      <table name="box_participants" remarks="Участники обменов" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="box_id" nullable="false" remarks="Обмен (FK на boxes)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="box_participants_box_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="boxes"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="user_id" nullable="false" remarks="Пользователь (FK на users)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="box_participants_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="6" id="2" name="joined_at" nullable="false" remarks="Дата вступления в обмен" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="is_active" nullable="false" remarks="Флаг активности участника" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="id" nullable="false" remarks="Уникальный идентификатор участника (UUID)" size="2147483647" type="uuid" typeCode="1111">
            <child column="participant1_id" foreignKey="chat_rooms_participant1_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="chat_rooms"/>
            <child column="participant2_id" foreignKey="chat_rooms_participant2_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="chat_rooms"/>
            <child column="giver_participant_id" foreignKey="deliveries_giver_participant_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="deliveries"/>
            <child column="receiver_participant_id" foreignKey="deliveries_receiver_participant_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="deliveries"/>
            <child column="giver_participant_id" foreignKey="draw_pairs_giver_participant_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="draw_pairs"/>
            <child column="receiver_participant_id" foreignKey="draw_pairs_receiver_participant_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="draw_pairs"/>
            <child column="from_participant_id" foreignKey="participant_exclusions_from_participant_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="participant_exclusions"/>
            <child column="to_participant_id" foreignKey="participant_exclusions_to_participant_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="participant_exclusions"/>
            <child column="participant_id" foreignKey="wishlists_participant_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="wishlists"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="created_at" nullable="false" remarks="Дата создания записи" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="updated_at" nullable="false" remarks="Дата последнего обновления" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="box_participants_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_box_participants_box_id" unique="false">
            <column ascending="true" name="box_id"/>
         </index>
         <index name="ix_box_participants_is_active" unique="false">
            <column ascending="true" name="is_active"/>
         </index>
         <index name="ix_box_participants_user_id" unique="false">
            <column ascending="true" name="user_id"/>
         </index>
         <index name="uq_box_participants_box_user" unique="true">
            <column ascending="true" name="box_id"/>
            <column ascending="true" name="user_id"/>
         </index>
      </table>
      <table name="boxes" remarks="Обмены подарками (коробки)" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="team_id" nullable="false" remarks="Команда владельца (FK на teams)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="boxes_team_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="teams"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="name" nullable="false" remarks="Название обмена" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="description" nullable="true" remarks="Описание обмена" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="2" id="3" name="budget_min" nullable="true" remarks="Минимальный бюджет (NUMERIC 10,2)" size="10" type="numeric" typeCode="2"/>
         <column autoUpdated="false" defaultValue="null" digits="2" id="4" name="budget_max" nullable="true" remarks="Максимальный бюджет (NUMERIC 10,2)" size="10" type="numeric" typeCode="2"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="currency" nullable="false" remarks="Валюта бюджета (RUB, USD, EUR)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="6" name="start_date" nullable="false" remarks="Дата начала обмена" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="7" name="draw_date" nullable="true" remarks="Дата проведения жеребьевки" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="8" name="delivery_deadline" nullable="true" remarks="Дедлайн доставки подарка" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="status" nullable="false" remarks="Статус обмена (FK на box_statuses)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="10" name="is_public_within_team" nullable="false" remarks="Флаг публичности в команде" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="11" name="allow_exclusions" nullable="false" remarks="Разрешить исключения кто-кому-не-дарит" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="12" name="max_wishlist_items" nullable="false" remarks="Максимум предметов в вишлисте" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="13" name="id" nullable="false" remarks="Уникальный идентификатор обмена (UUID)" size="2147483647" type="uuid" typeCode="1111">
            <child column="box_id" foreignKey="box_participants_box_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="box_participants"/>
            <child column="box_id" foreignKey="chat_rooms_box_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="chat_rooms"/>
            <child column="box_id" foreignKey="deliveries_box_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="deliveries"/>
            <child column="box_id" foreignKey="draw_results_box_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="draw_results"/>
            <child column="box_id" foreignKey="wishlists_box_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="wishlists"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="14" name="created_at" nullable="false" remarks="Дата создания обмена" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="15" name="updated_at" nullable="false" remarks="Дата последнего обновления" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="boxes_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_boxes_draw_date" unique="false">
            <column ascending="true" name="draw_date"/>
         </index>
         <index name="ix_boxes_start_date" unique="false">
            <column ascending="true" name="start_date"/>
         </index>
         <index name="ix_boxes_status" unique="false">
            <column ascending="true" name="status"/>
         </index>
         <index name="ix_boxes_team_id" unique="false">
            <column ascending="true" name="team_id"/>
         </index>
         <checkConstraint constraint="((budget_min IS NULL) OR (budget_max IS NULL) OR (budget_min &lt;= budget_max))" name="chk_boxes_budget"/>
         <checkConstraint constraint="((budget_min IS NULL) OR (budget_min &gt;= (0)::numeric))" name="chk_boxes_budget_positive"/>
         <checkConstraint constraint="((draw_date IS NULL) OR (start_date IS NULL) OR (draw_date &gt;= start_date))" name="chk_boxes_dates"/>
         <checkConstraint constraint="((delivery_deadline IS NULL) OR (draw_date IS NULL) OR (delivery_deadline &gt;= draw_date))" name="chk_boxes_delivery_deadline"/>
         <checkConstraint constraint="((max_wishlist_items &gt; 0) AND (max_wishlist_items &lt;= 100))" name="chk_boxes_max_items"/>
         <checkConstraint constraint="((char_length(name) &gt;= 2) AND (char_length(name) &lt;= 200))" name="chk_boxes_name_length"/>
      </table>
      <table name="chat_rooms" remarks="Чаты между дарителем и получателем" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="box_id" nullable="false" remarks="Обмен (FK на boxes)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="chat_rooms_box_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="boxes"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="draw_id" nullable="false" remarks="Жеребьевка (FK на draw_results)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="chat_rooms_draw_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="draw_results"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="participant1_id" nullable="false" remarks="Первый участник (FK на box_participants)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="chat_rooms_participant1_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="box_participants"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="participant2_id" nullable="false" remarks="Второй участник (FK на box_participants)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="chat_rooms_participant2_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="box_participants"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="is_active" nullable="false" remarks="Флаг активности чата" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="id" nullable="false" remarks="Уникальный идентификатор чата (UUID)" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="created_at" nullable="false" remarks="Дата создания чата" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="updated_at" nullable="false" remarks="Дата последнего сообщения" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="chat_rooms_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_chat_rooms_box_id" unique="false">
            <column ascending="true" name="box_id"/>
         </index>
         <index name="ix_chat_rooms_draw_id" unique="false">
            <column ascending="true" name="draw_id"/>
         </index>
         <index name="ix_chat_rooms_is_active" unique="false">
            <column ascending="true" name="is_active"/>
         </index>
         <index name="ix_chat_rooms_participant1_id" unique="false">
            <column ascending="true" name="participant1_id"/>
         </index>
         <index name="ix_chat_rooms_participant2_id" unique="false">
            <column ascending="true" name="participant2_id"/>
         </index>
         <index name="uq_chat_rooms_participants" unique="true">
            <column ascending="true" name="draw_id"/>
            <column ascending="true" name="participant1_id"/>
            <column ascending="true" name="participant2_id"/>
         </index>
         <checkConstraint constraint="(participant1_id &lt;&gt; participant2_id)" name="chk_chat_participants_different"/>
         <checkConstraint constraint="(participant1_id &lt; participant2_id)" name="chk_chat_participants_order"/>
      </table>
      <table name="deliveries" remarks="Доставки подарков" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="box_id" nullable="false" remarks="Обмен (FK на boxes)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="deliveries_box_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="boxes"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="giver_participant_id" nullable="false" remarks="Даритель (FK на box_participants)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="deliveries_giver_participant_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="box_participants"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="receiver_participant_id" nullable="false" remarks="Получатель (FK на box_participants)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="deliveries_receiver_participant_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="box_participants"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="status" nullable="false" remarks="Статус доставки (FK на delivery_statuses)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="transport_company" nullable="true" remarks="Транспортная компания (FK на transport_companies)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="tracking_number" nullable="true" remarks="Трекинг-номер" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="pvz_address" nullable="true" remarks="Адрес ПВЗ" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="qr_code_data" nullable="true" remarks="Данные QR-кода" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="gift_photo_url" nullable="true" remarks="URL фото подарка в MinIO" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="gift_description" nullable="true" remarks="Описание подарка" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="10" name="shipped_at" nullable="true" remarks="Дата отправки" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="11" name="delivered_at" nullable="true" remarks="Дата получения" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="12" name="id" nullable="false" remarks="Уникальный идентификатор доставки (UUID)" size="2147483647" type="uuid" typeCode="1111">
            <child column="delivery_id" foreignKey="votes_delivery_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="votes"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="13" name="created_at" nullable="false" remarks="Дата создания записи" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="14" name="updated_at" nullable="false" remarks="Дата последнего обновления" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="deliveries_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_deliveries_box_id" unique="false">
            <column ascending="true" name="box_id"/>
         </index>
         <index name="ix_deliveries_giver_participant_id" unique="false">
            <column ascending="true" name="giver_participant_id"/>
         </index>
         <index name="ix_deliveries_receiver_participant_id" unique="false">
            <column ascending="true" name="receiver_participant_id"/>
         </index>
         <index name="ix_deliveries_status" unique="false">
            <column ascending="true" name="status"/>
         </index>
         <index name="ix_deliveries_transport_company" unique="false">
            <column ascending="true" name="transport_company"/>
         </index>
         <checkConstraint constraint="((shipped_at IS NULL) OR (delivered_at IS NULL) OR (delivered_at &gt;= shipped_at))" name="chk_deliveries_dates"/>
         <checkConstraint constraint="(giver_participant_id &lt;&gt; receiver_participant_id)" name="chk_deliveries_different_participants"/>
         <checkConstraint constraint="((tracking_number IS NULL) OR ((char_length(tracking_number) &gt;= 5) AND (char_length(tracking_number) &lt;= 100)))" name="chk_deliveries_tracking_format"/>
      </table>
      <table name="dictionary" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <child column="dictionary_id" foreignKey="dictionary_item_dictionary_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="dictionary_item"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="code" nullable="false" remarks="Код словаря (transport_companies, box_statuses, etc.)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="name" nullable="false" remarks="Название словаря" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="description" nullable="true" remarks="Описание словаря" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="is_active" nullable="false" remarks="Активен ли словарь" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="extra_data" nullable="true" remarks="Дополнительные настройки словаря (JSONB)" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="6" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="7" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="dictionary_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_dictionary_code" unique="true">
            <column ascending="true" name="code"/>
         </index>
         <index name="ix_dictionary_is_active" unique="false">
            <column ascending="true" name="is_active"/>
         </index>
         <checkConstraint constraint="(code ~ '^[a-z][a-z0-9_]*$'::text)" name="chk_dictionary_code_format"/>
      </table>
      <table name="dictionary_item" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <child column="parent_id" foreignKey="dictionary_item_parent_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="dictionary_item"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="dictionary_id" nullable="false" remarks="ID словаря" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="dictionary_item_dictionary_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="dictionary"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="parent_id" nullable="true" remarks="ID родительского элемента (для вложенности)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="dictionary_item_parent_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="dictionary_item"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="code" nullable="false" remarks="Код элемента (cdek, russian_post, etc.)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="name" nullable="false" remarks="Название элемента" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="description" nullable="true" remarks="Описание элемента" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="sort_order" nullable="false" remarks="Порядок сортировки" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="is_active" nullable="false" remarks="Активен ли элемент" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="icon" nullable="true" remarks="Иконка элемента (emoji или URL)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="color" nullable="true" remarks="Цвет элемента (hex)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="10" name="extra_data" nullable="true" remarks="Дополнительные данные элемента (JSONB)" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="11" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="12" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="dictionary_item_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_dictionary_item_dictionary_code" unique="true">
            <column ascending="true" name="dictionary_id"/>
            <column ascending="true" name="code"/>
         </index>
         <index name="ix_dictionary_item_dictionary_id" unique="false">
            <column ascending="true" name="dictionary_id"/>
         </index>
         <index name="ix_dictionary_item_is_active" unique="false">
            <column ascending="true" name="is_active"/>
         </index>
         <index name="ix_dictionary_item_parent_id" unique="false">
            <column ascending="true" name="parent_id"/>
         </index>
         <index name="ix_dictionary_item_sort" unique="false">
            <column ascending="true" name="dictionary_id"/>
            <column ascending="true" name="sort_order"/>
         </index>
         <index name="ix_dictionary_item_sort_order" unique="false">
            <column ascending="true" name="sort_order"/>
         </index>
         <checkConstraint constraint="(code ~ '^[a-z][a-z0-9_]*$'::text)" name="chk_dictionary_item_code_format"/>
      </table>
      <table name="draw_pairs" remarks="Пары даритель-получатель" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="draw_id" nullable="false" remarks="Жеребьевка (FK на draw_results)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="draw_pairs_draw_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="draw_results"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="giver_participant_id" nullable="false" remarks="Даритель (FK на box_participants)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="draw_pairs_giver_participant_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="box_participants"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="receiver_participant_id" nullable="false" remarks="Получатель (FK на box_participants)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="draw_pairs_receiver_participant_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="box_participants"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="id" nullable="false" remarks="Уникальный идентификатор пары (UUID)" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="4" name="created_at" nullable="false" remarks="Дата создания пары" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="updated_at" nullable="false" remarks="Дата последнего обновления" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="draw_pairs_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_draw_pairs_draw_id" unique="false">
            <column ascending="true" name="draw_id"/>
         </index>
         <index name="ix_draw_pairs_giver_participant_id" unique="false">
            <column ascending="true" name="giver_participant_id"/>
         </index>
         <index name="ix_draw_pairs_receiver_participant_id" unique="false">
            <column ascending="true" name="receiver_participant_id"/>
         </index>
         <index name="uq_draw_pairs_giver" unique="true">
            <column ascending="true" name="draw_id"/>
            <column ascending="true" name="giver_participant_id"/>
         </index>
         <index name="uq_draw_pairs_receiver" unique="true">
            <column ascending="true" name="draw_id"/>
            <column ascending="true" name="receiver_participant_id"/>
         </index>
         <checkConstraint constraint="(giver_participant_id &lt;&gt; receiver_participant_id)" name="chk_draw_pairs_different_participants"/>
      </table>
      <table name="draw_results" remarks="Результаты жеребьевок" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="box_id" nullable="false" remarks="Обмен (FK на boxes)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="draw_results_box_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="boxes"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="6" id="1" name="draw_date" nullable="false" remarks="Дата проведения жеребьевки" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="is_manual" nullable="false" remarks="Флаг ручной жеребьевки" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="performed_by" nullable="true" remarks="Кто провел жеребьевку (FK на users)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="draw_results_performed_by_fkey" implied="false" onDeleteCascade="false" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="id" nullable="false" remarks="Уникальный идентификатор жеребьевки (UUID)" size="2147483647" type="uuid" typeCode="1111">
            <child column="draw_id" foreignKey="chat_rooms_draw_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="chat_rooms"/>
            <child column="draw_id" foreignKey="draw_pairs_draw_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="draw_pairs"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="created_at" nullable="false" remarks="Дата создания записи" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="updated_at" nullable="false" remarks="Дата последнего обновления" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="draw_results_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_draw_results_box_id" unique="false">
            <column ascending="true" name="box_id"/>
         </index>
         <index name="ix_draw_results_draw_date" unique="false">
            <column ascending="true" name="draw_date"/>
         </index>
         <index name="ix_draw_results_performed_by" unique="false">
            <column ascending="true" name="performed_by"/>
         </index>
         <checkConstraint constraint="(draw_date &lt;= now())" name="chk_draw_results_date"/>
      </table>
      <table name="email_2fa_codes" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="user_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="email_2fa_codes_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="code" nullable="false" remarks="" size="6" type="varchar" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="3" name="expires_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="is_used" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="5" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="email_2fa_codes_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_email_2fa_codes_code" unique="false">
            <column ascending="true" name="code"/>
         </index>
         <index name="ix_email_2fa_codes_user_id" unique="false">
            <column ascending="true" name="user_id"/>
         </index>
         <index name="ix_email_2fa_codes_user_id_created_at" unique="false">
            <column ascending="true" name="user_id"/>
            <column ascending="true" name="created_at"/>
         </index>
         <checkConstraint constraint="(expires_at &gt; created_at)" name="chk_email_2fa_codes_expires"/>
         <checkConstraint constraint="((code)::text ~ '^[0-9a-f]{6}$'::text)" name="chk_email_2fa_codes_format"/>
      </table>
      <table name="email_verification_codes" numRows="71" remarks="Коды подтверждения email" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="id" nullable="false" remarks="Уникальный идентификатор (UUID)" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="user_id" nullable="false" remarks="Владелец кода (FK на users)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="email_verification_codes_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="code" nullable="false" remarks="6-значный код подтверждения" size="6" type="varchar" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="3" name="expires_at" nullable="false" remarks="Дата истечения срока действия (10 минут)" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="is_used" nullable="false" remarks="Флаг использования кода" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="5" name="created_at" nullable="false" remarks="Дата создания кода" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="updated_at" nullable="false" remarks="Дата последнего обновления" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="email_verification_codes_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_email_verification_codes_user_id" unique="false">
            <column ascending="true" name="user_id"/>
         </index>
         <index name="ix_verification_codes_code" unique="false">
            <column ascending="true" name="code"/>
         </index>
         <index name="ix_verification_codes_user_id_created_at" unique="false">
            <column ascending="true" name="user_id"/>
            <column ascending="true" name="created_at"/>
         </index>
         <checkConstraint constraint="(expires_at &gt; created_at)" name="chk_verification_codes_expires"/>
         <checkConstraint constraint="((code)::text ~ '^[0-9]{6}$'::text)" name="chk_verification_codes_format"/>
      </table>
      <table name="friendships" remarks="Связи между пользователями: друзья, запросы и блокировки" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="user_id_1" nullable="false" remarks="ID первого пользователя (всегда меньший UUID)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="friendships_user_id_1_fkey" implied="false" onDeleteCascade="true" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="user_id_2" nullable="false" remarks="ID второго пользователя (всегда больший UUID)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="friendships_user_id_2_fkey" implied="false" onDeleteCascade="true" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="requester_id" nullable="false" remarks="ID пользователя, который создал запрос или инициировал блокировку" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="friendships_requester_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="'PENDING'::text" digits="0" id="4" name="status" nullable="false" remarks="Текущее состояние связи: PENDING (ожидание), ACCEPTED (друзья), BLOCKED (бан), REJECTED (отклонено)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'{}'::jsonb" digits="0" id="5" name="extra_params" nullable="false" remarks="JSON-объект для доп. данных: {&quot;alias&quot;: &quot;Ник&quot;, &quot;note&quot;: &quot;Заметка&quot;, &quot;privacy&quot;: &quot;friends_only&quot;}" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="friendships_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="idx_friendships_params" unique="false">
            <column ascending="true" name="extra_params"/>
         </index>
         <index name="idx_friendships_requester" unique="false">
            <column ascending="true" name="requester_id"/>
         </index>
         <index name="idx_friendships_u1_status" unique="false">
            <column ascending="true" name="user_id_1"/>
            <column ascending="true" name="status"/>
         </index>
         <index name="idx_friendships_u2_status" unique="false">
            <column ascending="true" name="user_id_2"/>
            <column ascending="true" name="status"/>
         </index>
         <index name="unique_friendship" unique="true">
            <column ascending="true" name="user_id_1"/>
            <column ascending="true" name="user_id_2"/>
         </index>
      </table>
      <table name="notifications" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="user_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="notifications_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="type" nullable="false" remarks="Тип уведомления: email, draw_result, invite, message, gift_sent, gift_received, vote" size="50" type="varchar" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="title" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="message" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="is_read" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="data" nullable="true" remarks="Дополнительные данные уведомления (JSONB)" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="7" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="8" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="notifications_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_notifications_created_at" unique="false">
            <column ascending="true" name="created_at"/>
         </index>
         <index name="ix_notifications_is_read" unique="false">
            <column ascending="true" name="is_read"/>
         </index>
         <index name="ix_notifications_user_created" unique="false">
            <column ascending="true" name="user_id"/>
            <column ascending="true" name="created_at"/>
         </index>
         <index name="ix_notifications_user_id" unique="false">
            <column ascending="true" name="user_id"/>
         </index>
         <checkConstraint constraint="((type)::text = ANY ((ARRAY['email'::character varying, 'draw_result'::character varying, 'invite'::character varying, 'message'::character varying, 'gift_sent'::character varying, 'gift_received'::character varying, 'vote'::character varying])::text[]))" name="chk_notifications_type"/>
      </table>
      <table name="ownership_transfer_requests" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="team_id" nullable="false" remarks="ID команды" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="ownership_transfer_requests_team_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="teams"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="from_user_id" nullable="false" remarks="ID текущего владельца (инициатор)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="ownership_transfer_requests_from_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="to_user_email" nullable="false" remarks="Email получателя (нового владельца)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="to_user_id" nullable="true" remarks="ID получателя (заполняется при создании)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="ownership_transfer_requests_to_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="status" nullable="false" remarks="Статус: pending, accepted, declined, expired, cancelled" size="50" type="varchar" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="6" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="7" name="expires_at" nullable="false" remarks="Срок действия запроса" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="8" name="accepted_at" nullable="true" remarks="Когда принято" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="9" name="declined_at" nullable="true" remarks="Когда отклонено" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="10" name="cancelled_at" nullable="true" remarks="Когда отменено" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="ownership_transfer_requests_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_ownership_transfer_expires" unique="false">
            <column ascending="true" name="expires_at"/>
         </index>
         <index name="ix_ownership_transfer_from_user_id" unique="false">
            <column ascending="true" name="from_user_id"/>
         </index>
         <index name="ix_ownership_transfer_status" unique="false">
            <column ascending="true" name="status"/>
         </index>
         <index name="ix_ownership_transfer_team_id" unique="false">
            <column ascending="true" name="team_id"/>
         </index>
         <index name="ix_ownership_transfer_team_status" unique="true">
            <column ascending="true" name="team_id"/>
            <column ascending="true" name="status"/>
         </index>
         <index name="ix_ownership_transfer_to_user_email" unique="false">
            <column ascending="true" name="to_user_email"/>
         </index>
         <index name="ix_ownership_transfer_to_user_id" unique="false">
            <column ascending="true" name="to_user_id"/>
         </index>
         <checkConstraint constraint="(expires_at &gt; created_at)" name="chk_ownership_transfer_expires"/>
         <checkConstraint constraint="((status)::text = ANY ((ARRAY['pending'::character varying, 'accepted'::character varying, 'declined'::character varying, 'expired'::character varying, 'cancelled'::character varying])::text[]))" name="chk_ownership_transfer_status"/>
      </table>
      <table name="participant_exclusions" remarks="Исключения для жеребьевки (кто кому не дарит)" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="from_participant_id" nullable="false" remarks="Участник который не дарит (FK на box_participants)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="participant_exclusions_from_participant_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="box_participants"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="to_participant_id" nullable="false" remarks="Участник которому не дарит (FK на box_participants)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="participant_exclusions_to_participant_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="box_participants"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="reason" nullable="true" remarks="Причина исключения (опционально)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="3" name="created_at" nullable="false" remarks="Дата создания исключения" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="id" nullable="false" remarks="Уникальный идентификатор (UUID)" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="participant_exclusions_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_participant_exclusions_from_participant_id" unique="false">
            <column ascending="true" name="from_participant_id"/>
         </index>
         <index name="ix_participant_exclusions_to_participant_id" unique="false">
            <column ascending="true" name="to_participant_id"/>
         </index>
         <index name="uq_exclusions_from_to" unique="true">
            <column ascending="true" name="from_participant_id"/>
            <column ascending="true" name="to_participant_id"/>
         </index>
         <checkConstraint constraint="(from_participant_id &lt;&gt; to_participant_id)" name="chk_exclusions_different_participants"/>
      </table>
      <table name="password_reset_codes" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="user_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="password_reset_codes_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="code" nullable="false" remarks="" size="6" type="varchar" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="3" name="expires_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="is_used" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="5" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="password_reset_codes_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_password_reset_codes_code" unique="false">
            <column ascending="true" name="code"/>
         </index>
         <index name="ix_password_reset_codes_user_id" unique="false">
            <column ascending="true" name="user_id"/>
         </index>
         <index name="ix_password_reset_codes_user_id_created_at" unique="false">
            <column ascending="true" name="user_id"/>
            <column ascending="true" name="created_at"/>
         </index>
         <checkConstraint constraint="(expires_at &gt; created_at)" name="chk_password_reset_codes_expires"/>
         <checkConstraint constraint="((code)::text ~ '^[0-9a-f]{6}$'::text)" name="chk_password_reset_codes_format"/>
      </table>
      <table name="refresh_tokens" numRows="230" remarks="Токены обновления JWT сессий" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="user_id" nullable="false" remarks="Владелец токена (FK на users)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="refresh_tokens_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="token_hash" nullable="false" remarks="Хеш refresh токена" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="2" name="expires_at" nullable="false" remarks="Дата истечения срока действия" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="is_revoked" nullable="false" remarks="Флаг отзыва токена" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="device_info" nullable="true" remarks="Информация об устройстве" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="ip_address" nullable="true" remarks="IP адрес создания сессии" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="id" nullable="false" remarks="Уникальный идентификатор токена (UUID)" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="created_at" nullable="false" remarks="Дата создания токена" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="8" name="updated_at" nullable="false" remarks="Дата последнего обновления" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="refresh_tokens_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_refresh_tokens_expires_at" unique="false">
            <column ascending="true" name="expires_at"/>
         </index>
         <index name="ix_refresh_tokens_is_revoked" unique="false">
            <column ascending="true" name="is_revoked"/>
         </index>
         <index name="ix_refresh_tokens_token_hash" unique="false">
            <column ascending="true" name="token_hash"/>
         </index>
         <index name="ix_refresh_tokens_user_id" unique="false">
            <column ascending="true" name="user_id"/>
         </index>
         <checkConstraint constraint="(expires_at &gt; now())" name="chk_refresh_tokens_expires"/>
      </table>
      <table name="team_invite_tokens" remarks="Одноразовые токены для приглашения в команды (Magic Links)" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="Уникальный идентификатор токена" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="team_id" nullable="false" remarks="ID команды, в которую приглашают" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="team_invite_tokens_team_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="teams"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="invited_by" nullable="false" remarks="ID пользователя, который отправил приглашение" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="team_invite_tokens_invited_by_fkey" implied="false" onDeleteCascade="true" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="email" nullable="false" remarks="Email приглашаемого пользователя" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="token" nullable="false" remarks="Случайный токен (64 hex символа) для Magic Link" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="5" name="expires_at" nullable="false" remarks="Срок действия токена (7 дней)" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="6" name="used_at" nullable="true" remarks="Когда токен был использован (NULL если не использован)" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="created_at" nullable="true" remarks="Дата создания токена" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="8" name="updated_at" nullable="true" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="team_invite_tokens_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="idx_team_invite_tokens_email" unique="false">
            <column ascending="true" name="email"/>
         </index>
         <index name="idx_team_invite_tokens_expires_at" unique="false">
            <column ascending="true" name="expires_at"/>
         </index>
         <index name="idx_team_invite_tokens_team_id" unique="false">
            <column ascending="true" name="team_id"/>
         </index>
         <index name="idx_team_invite_tokens_token" unique="false">
            <column ascending="true" name="token"/>
         </index>
         <index name="team_invite_tokens_token_key" unique="true">
            <column ascending="true" name="token"/>
         </index>
      </table>
      <table name="team_invites" remarks="" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="team_id" nullable="false" remarks="ID команды" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="team_invites_team_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="teams"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="email" nullable="false" remarks="Email приглашаемого" size="255" type="varchar" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="token" nullable="false" remarks="Уникальный токен приглашения" size="255" type="varchar" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="created_by" nullable="false" remarks="ID отправителя" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="team_invites_created_by_fkey" implied="false" onDeleteCascade="true" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="6" id="5" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="6" name="expires_at" nullable="false" remarks="Срок действия приглашения" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="status" nullable="false" remarks="Статус: pending, accepted, expired, revoked" size="50" type="varchar" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="8" name="accepted_at" nullable="true" remarks="Когда принято" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="9" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="team_invites_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_team_invites_email" unique="false">
            <column ascending="true" name="email"/>
         </index>
         <index name="ix_team_invites_expires" unique="false">
            <column ascending="true" name="expires_at"/>
         </index>
         <index name="ix_team_invites_team_id" unique="false">
            <column ascending="true" name="team_id"/>
         </index>
         <index name="ix_team_invites_token" unique="true">
            <column ascending="true" name="token"/>
         </index>
         <index name="uq_team_invites_team_email" unique="true">
            <column ascending="true" name="team_id"/>
            <column ascending="true" name="email"/>
         </index>
         <checkConstraint constraint="(expires_at &gt; created_at)" name="chk_team_invites_expires"/>
         <checkConstraint constraint="((status)::text = ANY ((ARRAY['pending'::character varying, 'accepted'::character varying, 'expired'::character varying, 'revoked'::character varying])::text[]))" name="chk_team_invites_status"/>
      </table>
      <table name="team_members" numRows="2" remarks="Участники команд" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="team_id" nullable="false" remarks="Команда (FK на teams)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="team_members_team_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="teams"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="user_id" nullable="false" remarks="Пользователь (FK на users)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="team_members_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="role" nullable="false" remarks="Роль в команде (FK на team_roles)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="3" name="joined_at" nullable="false" remarks="Дата вступления в команду" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="id" nullable="false" remarks="Уникальный идентификатор участника (UUID)" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="created_at" nullable="false" remarks="Дата создания записи" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="updated_at" nullable="false" remarks="Дата последнего обновления" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="team_members_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_team_members_role" unique="false">
            <column ascending="true" name="role"/>
         </index>
         <index name="ix_team_members_team_id" unique="false">
            <column ascending="true" name="team_id"/>
         </index>
         <index name="ix_team_members_user_id" unique="false">
            <column ascending="true" name="user_id"/>
         </index>
         <index name="uq_team_members_team_user" unique="true">
            <column ascending="true" name="team_id"/>
            <column ascending="true" name="user_id"/>
         </index>
         <checkConstraint constraint="(team_id &lt;&gt; user_id)" name="chk_team_members_different"/>
      </table>
      <table name="teams" numRows="2" remarks="Команды (группы пользователей)" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="name" nullable="false" remarks="Название команды" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="description" nullable="true" remarks="Описание команды" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="avatar_url" nullable="true" remarks="URL аватара команды в MinIO" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="owner_id" nullable="false" remarks="Владелец команды (FK на users)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="teams_owner_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="invite_code" nullable="false" remarks="Уникальный код приглашения" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="is_private" nullable="false" remarks="Флаг приватности команды" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="primary_language" nullable="false" remarks="Основной язык команды (ru, en)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="supported_languages" nullable="false" remarks="Массив поддерживаемых языков" size="2147483647" type="_text" typeCode="2003"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="id" nullable="false" remarks="Уникальный идентификатор команды (UUID)" size="2147483647" type="uuid" typeCode="1111">
            <child column="team_id" foreignKey="boxes_team_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="boxes"/>
            <child column="team_id" foreignKey="ownership_transfer_requests_team_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="ownership_transfer_requests"/>
            <child column="team_id" foreignKey="team_invite_tokens_team_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="team_invite_tokens"/>
            <child column="team_id" foreignKey="team_invites_team_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="team_invites"/>
            <child column="team_id" foreignKey="team_members_team_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="team_members"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="9" name="created_at" nullable="false" remarks="Дата создания команды" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="10" name="updated_at" nullable="false" remarks="Дата последнего обновления" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="teams_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_teams_invite_code" unique="true">
            <column ascending="true" name="invite_code"/>
         </index>
         <index name="ix_teams_is_private" unique="false">
            <column ascending="true" name="is_private"/>
         </index>
         <index name="ix_teams_owner_id" unique="false">
            <column ascending="true" name="owner_id"/>
         </index>
         <checkConstraint constraint="(char_length(invite_code) &gt;= 32)" name="chk_teams_invite_code_length"/>
         <checkConstraint constraint="((char_length(name) &gt;= 2) AND (char_length(name) &lt;= 200))" name="chk_teams_name_length"/>
      </table>
      <table name="user_consents" numRows="15" remarks="Хранение согласий пользователя на обработку персональных данных и правила сервиса (GDPR compliant)" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="gen_random_uuid()" digits="0" id="0" name="id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="user_id" nullable="false" remarks="" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="user_consents_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="consent_type" nullable="false" remarks="Тип согласия: terms_of_service, privacy_policy, data_processing" size="50" type="varchar" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'1.0'::character varying" digits="0" id="3" name="consent_version" nullable="false" remarks="Версия документа на момент согласия" size="20" type="varchar" typeCode="12"/>
         <column autoUpdated="false" defaultValue="true" digits="0" id="4" name="is_given" nullable="false" remarks="Дано ли согласие (True = дано, False = отозвано)" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="ip_address" nullable="true" remarks="IP адрес пользователя" size="45" type="varchar" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="user_agent" nullable="true" remarks="User Agent браузера" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="device_info" nullable="true" remarks="Дополнительная информация об устройстве (JSONB)" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="8" name="created_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="9" name="updated_at" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="user_consents_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_user_consents_created_at" unique="false">
            <column ascending="true" name="created_at"/>
         </index>
         <index name="ix_user_consents_user_id" unique="false">
            <column ascending="true" name="user_id"/>
         </index>
         <index name="ix_user_consents_user_id_type" unique="false">
            <column ascending="true" name="user_id"/>
            <column ascending="true" name="consent_type"/>
         </index>
         <index name="uq_user_consents_unique" unique="true">
            <column ascending="true" name="user_id"/>
            <column ascending="true" name="consent_type"/>
            <column ascending="true" name="consent_version"/>
         </index>
      </table>
      <table name="users" numRows="5" remarks="Пользователи системы" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="email" nullable="false" remarks="Email адрес (уникальный, используется для входа)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="password_hash" nullable="false" remarks="Хеш пароля (bcrypt)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="first_name" nullable="true" remarks="Имя пользователя" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="last_name" nullable="true" remarks="Фамилия пользователя" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="avatar_url" nullable="true" remarks="URL аватара в MinIO" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="totp_secret" nullable="true" remarks="Секретный ключ для TOTP 2FA" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="is_2fa_enabled" nullable="false" remarks="Флаг включенной двухфакторной аутентификации" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="is_2fa_email_enabled" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="8" name="preferred_2fa_method" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="phone" nullable="true" remarks="Номер телефона" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="10" name="preferred_transport" nullable="true" remarks="Предпочитаемая транспортная компания (FK на transport_companies)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="11" name="default_pvz_address" nullable="true" remarks="Адрес ПВЗ по умолчанию" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="12" name="pvz_addresses" nullable="true" remarks="JSONB: адреса доставки по транспортным компаниям ({tc_id: {address, is_home_delivery, comment}})" size="2147483647" type="jsonb" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="13" name="is_active" nullable="false" remarks="Флаг активности пользователя" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="14" name="is_verified" nullable="false" remarks="Флаг подтвержденного email" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="15" name="is_admin" nullable="false" remarks="Глобальный админ системы (только через БД, нет API)" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="16" name="last_login" nullable="true" remarks="Дата последнего входа" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="17" name="id" nullable="false" remarks="Уникальный идентификатор пользователя (UUID)" size="2147483647" type="uuid" typeCode="1111">
            <child column="receiver_id" foreignKey="anonymous_hints_receiver_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="anonymous_hints"/>
            <child column="sender_id" foreignKey="anonymous_hints_sender_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="anonymous_hints"/>
            <child column="user_id" foreignKey="box_participants_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="box_participants"/>
            <child column="performed_by" foreignKey="draw_results_performed_by_fkey" implied="false" onDeleteCascade="false" schema="public" table="draw_results"/>
            <child column="user_id" foreignKey="email_2fa_codes_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="email_2fa_codes"/>
            <child column="user_id" foreignKey="email_verification_codes_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="email_verification_codes"/>
            <child column="requester_id" foreignKey="friendships_requester_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="friendships"/>
            <child column="user_id_1" foreignKey="friendships_user_id_1_fkey" implied="false" onDeleteCascade="true" schema="public" table="friendships"/>
            <child column="user_id_2" foreignKey="friendships_user_id_2_fkey" implied="false" onDeleteCascade="true" schema="public" table="friendships"/>
            <child column="user_id" foreignKey="notifications_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="notifications"/>
            <child column="from_user_id" foreignKey="ownership_transfer_requests_from_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="ownership_transfer_requests"/>
            <child column="to_user_id" foreignKey="ownership_transfer_requests_to_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="ownership_transfer_requests"/>
            <child column="user_id" foreignKey="password_reset_codes_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="password_reset_codes"/>
            <child column="user_id" foreignKey="refresh_tokens_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="refresh_tokens"/>
            <child column="invited_by" foreignKey="team_invite_tokens_invited_by_fkey" implied="false" onDeleteCascade="true" schema="public" table="team_invite_tokens"/>
            <child column="created_by" foreignKey="team_invites_created_by_fkey" implied="false" onDeleteCascade="true" schema="public" table="team_invites"/>
            <child column="user_id" foreignKey="team_members_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="team_members"/>
            <child column="owner_id" foreignKey="teams_owner_id_fkey" implied="false" onDeleteCascade="false" schema="public" table="teams"/>
            <child column="user_id" foreignKey="user_consents_user_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="user_consents"/>
            <child column="voter_id" foreignKey="votes_voter_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="votes"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="18" name="created_at" nullable="false" remarks="Дата регистрации" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="19" name="updated_at" nullable="false" remarks="Дата последнего обновления профиля" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="20" name="birthday" nullable="true" remarks="Дата рождения пользователя для уведомлений друзьям" size="13" type="date" typeCode="91"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="users_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_users_created_at" unique="false">
            <column ascending="true" name="created_at"/>
         </index>
         <index name="ix_users_email" unique="true">
            <column ascending="true" name="email"/>
         </index>
         <index name="ix_users_is_active" unique="false">
            <column ascending="true" name="is_active"/>
         </index>
         <index name="ix_users_preferred_transport" unique="false">
            <column ascending="true" name="preferred_transport"/>
         </index>
         <checkConstraint constraint="(email ~* '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$'::text)" name="chk_users_email_format"/>
         <checkConstraint constraint="((phone IS NULL) OR (phone ~ '^\+?[0-9\s\-\(\)]+$'::text))" name="chk_users_phone_format"/>
      </table>
      <table name="votes" remarks="Голоса за подарки в галерее" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="delivery_id" nullable="false" remarks="Доставка (FK на deliveries)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="votes_delivery_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="deliveries"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="voter_id" nullable="false" remarks="Голосующий (FK на users)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="votes_voter_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="users"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="vote_type" nullable="false" remarks="Тип голоса (like/dislike)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="3" name="voted_at" nullable="false" remarks="Дата голосования" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="id" nullable="false" remarks="Уникальный идентификатор голоса (UUID)" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="created_at" nullable="false" remarks="Дата создания записи" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="updated_at" nullable="false" remarks="Дата последнего обновления" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="votes_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_votes_delivery_id" unique="false">
            <column ascending="true" name="delivery_id"/>
         </index>
         <index name="ix_votes_vote_type" unique="false">
            <column ascending="true" name="vote_type"/>
         </index>
         <index name="ix_votes_voter_id" unique="false">
            <column ascending="true" name="voter_id"/>
         </index>
         <index name="uq_votes_delivery_voter" unique="true">
            <column ascending="true" name="delivery_id"/>
            <column ascending="true" name="voter_id"/>
         </index>
         <checkConstraint constraint="(vote_type = ANY (ARRAY['like'::text, 'super'::text, 'favorite'::text]))" name="chk_votes_type"/>
      </table>
      <table name="wishlist_items" remarks="Предметы в вишлистах" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="wishlist_id" nullable="false" remarks="Вишлист (FK на wishlists)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="wishlist_items_wishlist_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="wishlists"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="name" nullable="false" remarks="Название предмета" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="description" nullable="true" remarks="Описание предмета (Markdown)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="url" nullable="true" remarks="Ссылка на товар" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="2" id="4" name="price" nullable="true" remarks="Примерная цена (NUMERIC 10,2)" size="10" type="numeric" typeCode="2"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="priority" nullable="false" remarks="Приоритет (1-высокий, 5-низкий)" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="is_purchased" nullable="false" remarks="Флаг купленного предмета" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="id" nullable="false" remarks="Уникальный идентификатор предмета (UUID)" size="2147483647" type="uuid" typeCode="1111">
            <child column="wishlist_item_id" foreignKey="anonymous_hints_wishlist_item_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="anonymous_hints"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="8" name="created_at" nullable="false" remarks="Дата добавления предмета" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="9" name="updated_at" nullable="false" remarks="Дата последнего обновления" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="wishlist_items_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_wishlist_items_is_purchased" unique="false">
            <column ascending="true" name="is_purchased"/>
         </index>
         <index name="ix_wishlist_items_wishlist_id" unique="false">
            <column ascending="true" name="wishlist_id"/>
         </index>
         <checkConstraint constraint="((char_length(name) &gt;= 1) AND (char_length(name) &lt;= 500))" name="chk_wishlist_items_name_length"/>
         <checkConstraint constraint="((price IS NULL) OR (price &gt;= (0)::numeric))" name="chk_wishlist_items_price"/>
         <checkConstraint constraint="((priority &gt;= '-100'::integer) AND (priority &lt;= 100))" name="chk_wishlist_items_priority"/>
      </table>
      <table name="wishlists" remarks="Вишлисты участников" schema="public" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="box_id" nullable="false" remarks="Обмен (FK на boxes)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="wishlists_box_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="boxes"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="participant_id" nullable="false" remarks="Участник (FK на box_participants)" size="2147483647" type="uuid" typeCode="1111">
            <parent column="id" foreignKey="wishlists_participant_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="box_participants"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="content_md" nullable="true" remarks="Содержимое вишлиста (Markdown)" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="is_public_to_giver" nullable="false" remarks="Флаг видимости для дарителя" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="id" nullable="false" remarks="Уникальный идентификатор вишлиста (UUID)" size="2147483647" type="uuid" typeCode="1111">
            <child column="wishlist_id" foreignKey="wishlist_items_wishlist_id_fkey" implied="false" onDeleteCascade="true" schema="public" table="wishlist_items"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="5" name="created_at" nullable="false" remarks="Дата создания вишлиста" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="6" name="updated_at" nullable="false" remarks="Дата последнего обновления" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="wishlists_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ix_wishlists_box_id" unique="false">
            <column ascending="true" name="box_id"/>
         </index>
         <index name="ix_wishlists_participant_id" unique="false">
            <column ascending="true" name="participant_id"/>
         </index>
         <index name="uq_wishlists_participant" unique="true">
            <column ascending="true" name="participant_id"/>
         </index>
      </table>
   </tables>
</database>
