-- 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);