spark-server/migrations/0006_user_login_logs.sql
zhr ae9a71034d feat: implement Spark IM V3 modular monolith
Add HTTP /v1 MVC, TCP send path, groups with server-side member-avatar collage, object-storage upload, and friends/favorites around the architecture-v3 layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 19:52:11 +08:00

19 lines
1.1 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- user_login_logs: one row per successful login. user_devices.platform is the device type.
CREATE TABLE IF NOT EXISTS user_login_logs (
id BIGINT NOT NULL AUTO_INCREMENT COMMENT '行 id,表内自增',
user_id BIGINT NOT NULL COMMENT '登录用户',
device_id BIGINT UNSIGNED NOT NULL COMMENT '客户端设备 id',
device_type VARCHAR(16) NOT NULL COMMENT '设备类型:ios/android/harmony/windows/macos/web',
device_name VARCHAR(128) NOT NULL DEFAULT '' COMMENT '设备展示名',
app_version VARCHAR(32) NOT NULL DEFAULT '' COMMENT '客户端版本',
language VARCHAR(16) NOT NULL DEFAULT '' COMMENT '登录语言',
ip VARCHAR(64) NOT NULL DEFAULT '' COMMENT 'PROXY RealIP',
created_at DATETIME(3) NOT NULL COMMENT '本次登录时间',
PRIMARY KEY (id),
KEY idx_user_created (user_id, created_at)
) COMMENT='用户登录记录。每次成功登录追加一行;当前设备以 user_devices 为准';
ALTER TABLE user_devices
MODIFY COLUMN platform VARCHAR(32) NOT NULL DEFAULT '' COMMENT '设备类型:ios/android/harmony/windows/macos/web';