闲社服务运行正常AI智能体自动化平台
t

Teamgram数据库架构

技能标识:teamgram-database-schema

Complete database schema reference for Teamgram Server with all 43 tables, ER relationships, and key table structure explanations for the MySQL teamgram database.

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.0.0
检测标记
后台标记通过
免费
免费获取
0
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

Teamgram数据库架构

数据库 Schema(43 张表)与核心关系

概述

数据库位于 teamgramd/deploy/sql/,基础 schema 在 1_teamgram.sql(38 表),迁移补齐到 43 表。

所有服务共用同一个 MySQL 数据库 teamgram,字符集 utf8mb4。

43 张表完整列表

表名核心用途
authkeyinfosauthkey 元信息
authkeys
auth_key 存储(加密密钥) | | authsequpdates | 每个 auth_key 的 updates 序列号 | | authusers | authkey ↔ user 绑定关系 | | auths | 授权记录 | | bot_commands | Bot 命令列表 | | bots | Bot 信息 | | chatinviteparticipants | 通过邀请链接加入的成员 | | chat_invites | 聊天邀请链接 | | chat_participants | 群成员关系 | | chats | 群组信息 | | defaulthistoryttl | 默认历史消息 TTL | | devices | 推送设备/token | | dialog_filters | 对话文件夹 | | dialogs | 对话列表(每用户每对等方一行) | | documents | 文件/文档元数据 | | drafts | 消息草稿 | | encrypted_files | 加密文件 | | hash_tags | 消息 hashtag 索引 | | imported_contacts | 导入的联系人 | | messagereadoutbox | 消息已读状态(outbox 侧) | | messages | 消息存储(核心表) | | phone_books | 通讯录 | | photo_sizes | 照片尺寸变体 | | photos | 照片元数据 | | popular_contacts | 热门联系人 | | predefined_users | 预定义用户 | | saved_dialogs | 保存的消息对话 | | unregistered_contacts | 未注册联系人 | | user_contacts | 用户联系人关系 | | userglobalprivacy_settings | 全局隐私设置 | | usernotifysettings | 通知设置 | | userpeerblocks | 屏蔽关系 | | userpeersettings | 对等方设置 | | user_presences | 用户最后上线时间 | | user_privacies | 隐私规则 | | userprofilephotos | 用户头像 | | userptsupdates | 每用户 pts 更新序列 | | usersavedmusic | 保存的音乐 | | user_settings | 用户设置 | | username | 用户名 | | users | 用户信息(核心表) | | video_sizes | 视频尺寸变体 |

核心 ER 关系

text
users (user_id)
|\
| \-- authusers (authkeyid -> userid) # 登录设备/授权关系
| \-- devices (authkeyid, user_id) # push token / device
| \-- userpresences (userid) # last seen
| \-- userprofilephotos (userid -> photoid)
| \-- usersettings / userprivacies / usernotifysettings
|
\-- dialogs (userid, peertype, peer_id) # 会话列表
|
\-- messages (userid, peertype, peerid, dialogid1/2, dialogmessageid)
|
\-- documents/photos/encryptedfiles (+ photosizes/video_sizes)

chats (chat_id)
\-- chatparticipants (chatid, user_id)
\-- chatinvites / chatinvite_participants

关键表结构说明

users 表

  • - 核心用户信息表
  • userid 为主键(Snowflake ID)
  • 包含 phone、firstname、last_name、username 等字段
  • deleted 字段标记软删除

messages 表

  • - 消息存储核心表
  • 按 userid + peer 维度存储(inbox/outbox 双写)
  • dialogid1/dialogid2 用于双向对话定位
  • dialogmessageid 为对话内消息序号(递增)
  • messagetype 区分文本/媒体/服务消息等

dialogs 表

  • - 每个用户与每个对等方(私聊/群聊)一行
  • peertype: 1=user, 2=chat, 3=channel
  • 包含 unreadcount、readinboxmaxid、readoutboxmaxid
  • pinned 字段控制置顶排序

authkeys / authusers 表

  • - authkeys 存储 MTProto 授权密钥(256字节 authkey)
  • authusers 维护 authkeyid → userid 的绑定
  • 一个用户可以有多个 authkey(多设备登录)
  • authkeyid 是 authkey 的 SHA1 后 8 字节

chat_participants 表

  • - chatid + userid 复合主键
  • participanttype 区分普通成员/管理员/创建者
  • inviteruserid 记录邀请人
  • joinedat 记录加入时间

SQL 文件路径

  • - 基础 schema:teamgramd/deploy/sql/1_teamgram.sql
  • 迁移脚本:teamgramd/deploy/sql/ 下的后续编号文件

Source Code References

  • - Repository: https://github.com/teamgram/teamgram-server (Apache-2.0)

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 teamgram-database-schema-1776079218 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 teamgram-database-schema-1776079218 技能

通过命令行安装

skillhub install teamgram-database-schema-1776079218

下载

⬇ 下载 teamgram-database-schema v1.0.0(免费)

文件大小: 3.06 KB | 发布时间: 2026-4-15 14:37

v1.0.0 最新 2026-4-15 14:37
Initial release
返回顶部