Files
gochat/backend/migrations/000048_fix_reporting_events_rollups_schema.down.sql
T
rogee be38051ac5 Fix Reports 500, Settings white screen, SidebarGroup exceptions
ISS-01: Fix reporting_events_rollups table schema mismatch
- The init migration (000001) created columns (dimension, dimension_value,
  metric_name, value, value_in_business_hours, period) that do not match
  the GORM model which expects (date, dimension_type, dimension_id, metric,
  count, sum_value, sum_value_business_hours)
- Add migration 000048 to drop and recreate the table with correct schema
  matching the GORM model and all Go code that references it
- Fixes: GET /api/v2/accounts/:id/reports returning HTTP 500 with
  'column date does not exist (SQLSTATE 42703)'

ISS-02: Fix Settings > General page white screen
- AccountId.vue: add null-safe access for currentAccount.value.id before
  calling toString() — currentAccount can be {} when account data not yet
  loaded in store
- BuildInfo.vue: add null-safe access for globalConfig.value.gitSha and
  globalConfig.value.appVersion; guard copyGitSha with existence check;
  add v-if guard on gitSha span in template

ISS-04: Fix SidebarGroup mounted hook exceptions
- SidebarGroup.vue: Object.keys(child.to.params) throws TypeError when
  child.to.params is undefined; add null-safe fallback Object.keys(child.to?.params ?? {})
- This was the source of the 29 recurring JS exceptions on every Settings
  page navigation

ISS-05: Fix Vue Router root path warning
- Add root route { path: '/', redirect: '/app/login' } to silence
  'No match found for location with path /' warning
2026-07-08 10:02:29 +08:00

23 lines
982 B
SQL

-- Revert reporting_events_rollups to the original (incorrect) init schema structure.
-- WARNING: this restores the broken column names (dimension, dimension_value, metric_name,
-- value, value_in_business_hours, period) that do not match the GORM model.
DROP TABLE IF EXISTS reporting_events_rollups;
CREATE TABLE IF NOT EXISTS reporting_events_rollups (
id SERIAL PRIMARY KEY,
account_id INTEGER NOT NULL,
dimension VARCHAR(50) NOT NULL,
dimension_value VARCHAR(255) NOT NULL,
metric_name VARCHAR(50) NOT NULL,
value DOUBLE PRECISION NOT NULL,
value_in_business_hours DOUBLE PRECISION DEFAULT 0,
period VARCHAR(50) NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
deleted_at TIMESTAMP WITH TIME ZONE,
UNIQUE(account_id, dimension, dimension_value, metric_name, period)
);
CREATE INDEX idx_reporting_events_rollups_deleted_at ON reporting_events_rollups(deleted_at);