Backend: Basic implementation of annotation tags CRUD

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

After #211426 (closed) is completed, this issue should be ready to work on.

In this backend issue, we implement tags creating, reading, updating, deleting support.

Technical details

Copied over from #211426 (comment 363844487)

Annotations tags should be stored in new column tags is added to metrics_dashboard_annotations of type text[] which stores array of all annotation tags inside. That column should have been indexed with gin index. Resulting metrics_dashboard_annotations table after applying required changes looked like:

                                              Table "public.metrics_dashboard_annotations"
          Column     |           Type           | Collation | Nullable |                          Default
     ----------------+--------------------------+-----------+----------+-----------------------------------------------------------
      id             | bigint                   |           | not null | nextval('metrics_dashboard_annotations_id_seq'::regclass)
      starting_at    | timestamp with time zone |           | not null |
      ending_at      | timestamp with time zone |           |          |
      environment_id | bigint                   |           |          |
      cluster_id     | bigint                   |           |          |
      dashboard_path | character varying(255)   |           | not null |
      panel_xid      | character varying(255)   |           |          |
      description    | text                     |           | not null |
      tags           | text[]                   |           |          |
     Indexes:
         "metrics_dashboard_annotations_pkey" PRIMARY KEY, btree (id)
         "index_metrics_dashboard_annotations_on_cluster_id_and_3_columns" btree (cluster_id, dashboard_path, starting_at, ending_at) WHERE cluster_id IS NOT NULL
         "index_metrics_dashboard_annotations_on_environment_id_and_3_col" btree (environment_id, dashboard_path, starting_at, ending_at) WHERE environment_id IS NOT NULL
         "index_metrics_dashboard_annotations_on_timespan_end" btree (COALESCE(ending_at, starting_at))
         "research_idx_metrics_dashboard_annotation_tags" gin (tags)
     Foreign-key constraints:
         "fk_rails_345ab51043" FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE
         "fk_rails_aeb11a7643" FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE CASCADE     

Most likely this issue can be split into multiple MR inc: databse change, finders, services, and finally controllers

Edited by 🤖 GitLab Bot 🤖