清理: - 删除 34 份过时文档(gap reports/QA临时报告/验收报告/阶段性文档) - 删除 docs/.hermes/skills 第三方 skills 副本(16 文件) - 删除 skills-lock.json 目录归集: - 根目录仅保留 README.md 索引 - product/ — 产品与架构设计(PRD + ARCHITECTURE + P2设计文档 + AI/企业路线图) - tracking/ — Chatwoot parity 开发跟踪 - requirements/ — M01-M12 模块需求 - plans/ — 历史实现计划 - parity/ — 路由 parity 与前端契约 - qa/ — QA 报告与测试计划 - ops/ — 运维部署 命名规范: - 全小写 kebab-case,禁止全大写文件名 - product/tracking/ops 用 NN- 序号前缀 - requirements 用 MNN- 两位零填充模块号 - plans/qa 用 YYYY-MM-DD- 日期前缀 - requirements M1-M9 零填充为 M01-M09(修复字典序) 同步更新: - backend/cmd/route_parity/main.go 路径默认值 - backend/scripts/parity_frontend_smoke.sh 报告路径 - 所有 docs 内部交叉引用 - .gitignore 排除编译产物 (backend/gochat, backend/route_parity) - 新增迁移 000052/000053 - 前端 WS 相关修改
4.8 KiB
4.8 KiB
Code Context
Query: reporting, CSAT survey, campaign, reporting event, reporting rollup, report metrics, inbox CSAT template, dashboard stats
Entry Points
- CreateReportingEventsRollup (class) - db/migrate/20260211145813_create_reporting_events_rollup.rb:1
- AddIndexToReportingEvents (class) - db/migrate/20230612103936_add_index_to_reporting_events.rb:1
- AddIndexToReportingEventsForResponseDistribution (class) - db/migrate/20260130061021_add_index_to_reporting_events_for_response_distribution.rb:1
Related Symbols
- db/migrate/20260211145813_create_reporting_events_rollup.rb: change:2, create_rollups_table:9, add_rollups_indexes:24
- db/migrate/20230612103936_add_index_to_reporting_events.rb: change:4
- db/migrate/20260130061021_add_index_to_reporting_events_for_response_distribution.rb: change:4
Code
CreateReportingEventsRollup (db/migrate/20260211145813_create_reporting_events_rollup.rb:1)
class CreateReportingEventsRollup < ActiveRecord::Migration[7.1]
def change
create_rollups_table
add_rollups_indexes
end
private
def create_rollups_table
create_table :reporting_events_rollups do |t|
t.integer :account_id, null: false
t.date :date, null: false
t.string :dimension_type, null: false
t.bigint :dimension_id, null: false
t.string :metric, null: false
t.bigint :count, default: 0, null: false
t.float :sum_value, default: 0.0, null: false
t.float :sum_value_business_hours, default: 0.0, null: false
t.timestamps
end
end
def add_rollups_indexes
add_index :reporting_events_rollups,
[:account_id, :date, :dimension_type, :dimension_id, :metric],
unique: true, name: 'index_rollup_unique_key'
add_index :reporting_events_rollups,
[:account_id, :metric, :date],
name: 'index_rollup_timeseries'
add_index :reporting_events_rollups,
[:account_id, :dimension_type, :date],
name: 'index_rollup_summary'
end
end
AddIndexToReportingEvents (db/migrate/20230612103936_add_index_to_reporting_events.rb:1)
class AddIndexToReportingEvents < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def change
add_index :reporting_events, [:account_id, :name, :created_at], name: 'reporting_events__account_id__name__created_at', algorithm: :concurrently
end
end
AddIndexToReportingEventsForResponseDistribution (db/migrate/20260130061021_add_index_to_reporting_events_for_response_distribution.rb:1)
class AddIndexToReportingEventsForResponseDistribution < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def change
add_index :reporting_events,
[:account_id, :name, :inbox_id, :created_at],
name: 'index_reporting_events_for_response_distribution',
algorithm: :concurrently,
if_not_exists: true
end
end
change (db/migrate/20260211145813_create_reporting_events_rollup.rb:2)
def change
create_rollups_table
add_rollups_indexes
end
create_rollups_table (db/migrate/20260211145813_create_reporting_events_rollup.rb:9)
def create_rollups_table
create_table :reporting_events_rollups do |t|
t.integer :account_id, null: false
t.date :date, null: false
t.string :dimension_type, null: false
t.bigint :dimension_id, null: false
t.string :metric, null: false
t.bigint :count, default: 0, null: false
t.float :sum_value, default: 0.0, null: false
t.float :sum_value_business_hours, default: 0.0, null: false
t.timestamps
end
end
add_rollups_indexes (db/migrate/20260211145813_create_reporting_events_rollup.rb:24)
def add_rollups_indexes
add_index :reporting_events_rollups,
[:account_id, :date, :dimension_type, :dimension_id, :metric],
unique: true, name: 'index_rollup_unique_key'
add_index :reporting_events_rollups,
[:account_id, :metric, :date],
name: 'index_rollup_timeseries'
add_index :reporting_events_rollups,
[:account_id, :dimension_type, :date],
name: 'index_rollup_summary'
end
change (db/migrate/20230612103936_add_index_to_reporting_events.rb:4)
def change
add_index :reporting_events, [:account_id, :name, :created_at], name: 'reporting_events__account_id__name__created_at', algorithm: :concurrently
end
change (db/migrate/20260130061021_add_index_to_reporting_events_for_response_distribution.rb:4)
def change
add_index :reporting_events,
[:account_id, :name, :inbox_id, :created_at],
name: 'index_reporting_events_for_response_distribution',
algorithm: :concurrently,
if_not_exists: true
end