Skip to content

Replace statistics.file with statistics.spreadsheet_column #63

@PhantomWatson

Description

@PhantomWatson

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

  • Note the size of the statistics table
  • Rename spreadsheet_columns_metrics to just spreadsheet_columns and update class names in code
  • Create a statistics.spreadsheet_column_id field
  • Write a populate-ss-column-ids script to write to this field for every statistic record
  • Have this field be written to when import-stats creates or updates a record in statistics
  • Delete the statistics.file column and remove references from code
  • Note the new size of the statistics table and by what percent its size was reduced

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions