$ docker compose --env-file .env exec -T postgres psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "\\d users" -c "\\d chats" -c "\\d chat_members" -c "\\d messages" -c "TABLE schema_migrations" Table "public.users" Column | Type | Collation | Nullable | Default ---------------+--------------------------+-----------+----------+--------- id | uuid | | not null | username | text | | not null | display_name | text | | not null | password_hash | text | | not null | created_at | timestamp with time zone | | not null | Indexes: "users_pkey" PRIMARY KEY, btree (id) "users_username_key" UNIQUE CONSTRAINT, btree (username) Check constraints: "users_display_name_len" CHECK (char_length(display_name) >= 1 AND char_length(display_name) <= 100) "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) ON DELETE RESTRICT TABLE "messages" CONSTRAINT "messages_sender_id_fkey" FOREIGN KEY (sender_id) REFERENCES users(id) ON DELETE RESTRICT Table "public.chats" Column | Type | Collation | Nullable | Default ------------+--------------------------+-----------+----------+--------- id | uuid | | not null | title | text | | not null | created_at | timestamp with time zone | | not null | Indexes: "chats_pkey" PRIMARY KEY, btree (id) Check constraints: "chats_title_len" 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 TABLE "messages" CONSTRAINT "messages_chat_id_fkey" FOREIGN KEY (chat_id) REFERENCES chats(id) ON DELETE CASCADE Table "public.chat_members" Column | Type | Collation | Nullable | Default ---------+------+-----------+----------+--------- chat_id | uuid | | not null | user_id | uuid | | not null | Indexes: "chat_members_pkey" PRIMARY KEY, btree (chat_id, user_id) "chat_members_user_idx" btree (user_id, chat_id) 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) ON DELETE RESTRICT Table "public.messages" Column | Type | Collation | Nullable | Default ------------+--------------------------+-----------+----------+--------- id | uuid | | not null | chat_id | uuid | | not null | sender_id | uuid | | not null | text | text | | not null | created_at | timestamp with time zone | | not null | Indexes: "messages_pkey" PRIMARY KEY, btree (id) "messages_chat_created_id_idx" btree (chat_id, created_at, id) Check constraints: "messages_text_len" CHECK (char_length(text) >= 1 AND char_length(text) <= 4000) Foreign-key constraints: "messages_chat_id_fkey" FOREIGN KEY (chat_id) REFERENCES chats(id) ON DELETE CASCADE "messages_sender_id_fkey" FOREIGN KEY (sender_id) REFERENCES users(id) ON DELETE RESTRICT version | applied_at ---------------+----------------------------- 0001_init.sql | 2026-10-20 13:35:37.6134+00 (1 row)