feat: add track point
This commit is contained in:
18
migrations/analytics_events.sql
Normal file
18
migrations/analytics_events.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- 数据埋点事件表
|
||||
CREATE TABLE IF NOT EXISTS `analytics_events` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`user_id` BIGINT NOT NULL COMMENT '用户ID',
|
||||
`event_name` VARCHAR(128) NOT NULL COMMENT '事件名称',
|
||||
`properties` JSON DEFAULT NULL COMMENT '事件属性(JSON)',
|
||||
`device_info` JSON DEFAULT NULL COMMENT '设备信息(JSON)',
|
||||
`meta_data` JSON DEFAULT NULL COMMENT '元数据(JSON,包含task_id等)',
|
||||
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_user_id` (`user_id`),
|
||||
INDEX `idx_event_name` (`event_name`),
|
||||
INDEX `idx_created_at` (`created_at`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据埋点事件表';
|
||||
|
||||
-- 创建复合索引以提高查询性能
|
||||
CREATE INDEX `idx_user_event` ON `analytics_events` (`user_id`, `event_name`);
|
||||
CREATE INDEX `idx_event_time` ON `analytics_events` (`event_name`, `created_at`);
|
||||
Reference in New Issue
Block a user