Add knowledge graph tables

What does this MR do and why?

Add knowledge graph basic models. These models will be extended with additional attributes in follow-up MRs when adding more functionality.

  • KnowledgeGraph::EnabledNamespace - represents a namespace for which we want to create a knowledge graph. For now we plan to have only knowledge graphs for project repositories, but I thought it would be better to link this graphs rather with namespaces (if in future we want to create graphs also for groups). For now namespace is restrictited only to ProjectNamespace (IOW knowledge graphs can be created only for projects).
  • when a namespace is deleted, its related EnabledNamespace record will have namespace_id field nullified (nullify foreign key) - the reason is that we will need to cleanup/delete knowledge graph DBs on zoekt nodes first. This will be done by a "cleanup" worker which will check for replicas with NULL enabled_namespace reference.
  • KnowledgeGraph::Replica - represents an instance of knowledge graph on a particular zoekt node. The plan is to deploy knowledge graphs on Zoekt nodes. To assure high availability, we will keep >1 replica for each graph. More details in design document.

Related to #540785 (closed)

Changelog: added EE: true

References

Screenshots or screen recordings

Before After

How to set up and validate locally

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.

Edited by Jan Provaznik

Merge request reports

Loading