Skip to content

Export a relationship map

What does this MR do and why?

This MR creates a rake task capable of exporting all associations defined in our models.

This relationship map will be used by a "database crawler" to determine isolation state of top-level groups and Organizations.

Example out is as follows:

  {
    "parent_table": "issues",
    "child_table": "epics",
    "primary_key": "id",
    "foreign_key": "issue_id",
    "relationship_type": "many_to_one",
    "reverse_association": {
      "name": "sync_object",
      "type": "belongs_to",
      "model": "Epic"
    },
    "polymorphic": false,
    "has_ar_forward": false,
    "has_ar_reverse": true,
    "has_fk_constraint": false,
    "data_sources": [
      "active_record"
    ],
    "is_through_association": false
  },

References

How to set up and validate locally

Execute rails db:relationships:all in your terminal.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading