Respond: Create & link model classes for tables that are missing them
Please see #442736 (closed) for details.
For Respond, we have identified 2 tables that are missing a Rails model and can benefit from it:
issues_prometheus_alert_events
issues_self_managed_prometheus_alert_events
These tables need to have a Rails model backing them because:
- once we have that, we can set a desired_sharding_key on these models. Setting of desired sharding keys requires a Rails model to be present for a table because we need to validate that the
belongs_to
association used to backfill this column actually exists and is valid.
Implementation plan:
- Create a Rails model for this table.
- Set up the
belongs_to
associations on this model based on the current state of columns on this table. - Link the
class
to the table using the table'sdb/docs/table_name.yml
file, with theclasses
key. Example.
Once class has been added in the yml
, grouptenant scale can run automations to set desired sharding keys for these tables.
PS: If the table is no longer used or is not needed, you needn't add a model, rather you can work on dropping the table altogether.