date: 2026-10-28T17:31:05Z  commit: 6468ee2
$ psql -c '\d+ users'
                                                      Table "public.users"
    Column     |           Type           | Collation | Nullable | Default | Storage  | Compression | Stats target | Description 
---------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
 id            | uuid                     |           | not null |         | plain    |             |              | 
 username      | text                     |           | not null |         | extended |             |              | 
 display_name  | text                     |           | not null |         | extended |             |              | 
 password_hash | text                     |           | not null |         | extended |             |              | 
 created_at    | timestamp with time zone |           | not null |         | plain    |             |              | 
Indexes:
    "users_pkey" PRIMARY KEY, btree (id)
    "users_username_key" UNIQUE CONSTRAINT, btree (username)
Check constraints:
    "users_display_name_check" CHECK (char_length(display_name) >= 1 AND char_length(display_name) <= 100)
    "users_password_hash_check" CHECK (password_hash ~~ '$argon2id$%'::text)
    "users_username_format" CHECK (username ~ '^[a-z0-9_]{3,32}$'::text)
Referenced by:
    TABLE "chat_members" CONSTRAINT "chat_members_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id)
    TABLE "sessions" CONSTRAINT "sessions_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
Access method: heap

$ psql -c '\d+ sessions'
                                                   Table "public.sessions"
   Column   |           Type           | Collation | Nullable | Default | Storage  | Compression | Stats target | Description 
------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
 token_hash | bytea                    |           | not null |         | extended |             |              | 
 user_id    | uuid                     |           | not null |         | plain    |             |              | 
 created_at | timestamp with time zone |           | not null |         | plain    |             |              | 
 expires_at | timestamp with time zone |           | not null |         | plain    |             |              | 
Indexes:
    "sessions_pkey" PRIMARY KEY, btree (token_hash)
    "sessions_user_idx" btree (user_id)
Check constraints:
    "sessions_check" CHECK (expires_at > created_at)
    "sessions_token_hash_check" CHECK (octet_length(token_hash) = 32)
Foreign-key constraints:
    "sessions_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
Access method: heap

$ psql -c '\d+ chats'
                                                       Table "public.chats"
     Column      |           Type           | Collation | Nullable | Default | Storage  | Compression | Stats target | Description 
-----------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
 id              | uuid                     |           | not null |         | plain    |             |              | 
 title           | text                     |           | not null |         | extended |             |              | 
 created_at      | timestamp with time zone |           | not null |         | plain    |             |              | 
 last_message_at | timestamp with time zone |           |          |         | plain    |             |              | 
Indexes:
    "chats_pkey" PRIMARY KEY, btree (id)
Check constraints:
    "chats_title_check" CHECK (char_length(title) >= 1 AND char_length(title) <= 100)
Referenced by:
    TABLE "chat_members" CONSTRAINT "chat_members_chat_id_fkey" FOREIGN KEY (chat_id) REFERENCES chats(id) ON DELETE CASCADE
Access method: heap

$ psql -c '\d+ chat_members'
                                                   Table "public.chat_members"
     Column      |           Type           | Collation | Nullable | Default | Storage | Compression | Stats target | Description 
-----------------+--------------------------+-----------+----------+---------+---------+-------------+--------------+-------------
 chat_id         | uuid                     |           | not null |         | plain   |             |              | 
 user_id         | uuid                     |           | not null |         | plain   |             |              | 
 position        | smallint                 |           | not null |         | plain   |             |              | 
 chat_created_at | timestamp with time zone |           | not null |         | plain   |             |              | 
Indexes:
    "chat_members_pkey" PRIMARY KEY, btree (chat_id, user_id)
    "chat_members_user_idx" btree (user_id, chat_created_at, chat_id)
Check constraints:
    "chat_members_position_check" CHECK ("position" >= 1 AND "position" <= 100)
Foreign-key constraints:
    "chat_members_chat_id_fkey" FOREIGN KEY (chat_id) REFERENCES chats(id) ON DELETE CASCADE
    "chat_members_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id)
Referenced by:
    TABLE "messages" CONSTRAINT "messages_chat_id_sender_id_fkey" FOREIGN KEY (chat_id, sender_id) REFERENCES chat_members(chat_id, user_id)
Access method: heap

$ psql -c '\d+ messages'
                                                   Table "public.messages"
   Column   |           Type           | Collation | Nullable | Default | Storage  | Compression | Stats target | Description 
------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
 id         | uuid                     |           | not null |         | plain    |             |              | 
 chat_id    | uuid                     |           | not null |         | plain    |             |              | 
 sender_id  | uuid                     |           | not null |         | plain    |             |              | 
 text       | text                     |           | not null |         | extended |             |              | 
 created_at | timestamp with time zone |           | not null |         | plain    |             |              | 
Indexes:
    "messages_pkey" PRIMARY KEY, btree (id)
    "messages_history_idx" btree (chat_id, created_at, id)
Check constraints:
    "messages_text_check" CHECK (char_length(text) >= 1 AND char_length(text) <= 4000)
Foreign-key constraints:
    "messages_chat_id_sender_id_fkey" FOREIGN KEY (chat_id, sender_id) REFERENCES chat_members(chat_id, user_id)
Access method: heap

$ psql -c '\d+ schema_migrations'
                                               Table "public.schema_migrations"
   Column   |           Type           | Collation | Nullable | Default | Storage  | Compression | Stats target | Description 
------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
 version    | text                     |           | not null |         | extended |             |              | 
 checksum   | text                     |           | not null |         | extended |             |              | 
 applied_at | timestamp with time zone |           | not null | now()   | plain    |             |              | 
Indexes:
    "schema_migrations_pkey" PRIMARY KEY, btree (version)
Access method: heap

$ psql -c 'SELECT version, left(checksum, 12), applied_at FROM schema_migrations'
  version  |   checksum   |          applied_at          
-----------+--------------+------------------------------
 0001_init | 9a13618f078a | 2026-10-28 17:14:47.21836+00
(1 row)

