Currently, a statistic is linked to a spreadsheet column by a chain of associations:
statistics has one metrics hasMany* spreadsheet_columns_metrics
And a statistic can be matched to a single spreadsheet column when statistics.file matches spreadsheet_columns_metrics.filename.
- This association is never used, so it's not actually defined in
MetricsTable.
It would be simpler and would reduce the size of the statistics table to replace statistics.file with statistics.spreadsheet_column_id. Incidentally, it now seems preferable to rename spreadsheet_columns_metrics to just spreadsheet_columns.
Steps
Currently, a statistic is linked to a spreadsheet column by a chain of associations:
MetricsTable.It would be simpler and would reduce the size of the
statisticstable to replacestatistics.filewithstatistics.spreadsheet_column_id. Incidentally, it now seems preferable to renamespreadsheet_columns_metricsto justspreadsheet_columns.Steps
statisticstablespreadsheet_columns_metricsto justspreadsheet_columnsand update class names in codestatistics.spreadsheet_column_idfieldpopulate-ss-column-idsscript to write to this field for every statistic recordimport-statscreates or updates a record instatisticsstatistics.filecolumn and remove references from codestatisticstable and by what percent its size was reduced