summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 18:09:19 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 18:09:19 +0000
commit3290d46655f07d7ae3dca788d6df9f326972ffd8 (patch)
tree0d24713e1592cdd3583257f14a52d46a22539ed1 /db/migrate
parentc6b3ec3f56fa32a0e0ed3de0d0878d25f1adaddf (diff)
downloadgitlab-ce-3290d46655f07d7ae3dca788d6df9f326972ffd8.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20200319124127_create_metrics_dashboard_annotations.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/db/migrate/20200319124127_create_metrics_dashboard_annotations.rb b/db/migrate/20200319124127_create_metrics_dashboard_annotations.rb
new file mode 100644
index 00000000000..4c57e38518a
--- /dev/null
+++ b/db/migrate/20200319124127_create_metrics_dashboard_annotations.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+# See https://docs.gitlab.com/ee/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class CreateMetricsDashboardAnnotations < ActiveRecord::Migration[6.0]
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ def change
+ create_table :metrics_dashboard_annotations do |t|
+ t.datetime_with_timezone :starting_at, null: false
+ t.datetime_with_timezone :ending_at
+ t.references :environment, index: false, foreign_key: { on_delete: :cascade }, null: true
+ t.references :cluster, index: false, foreign_key: { on_delete: :cascade }, null: true
+ t.string :dashboard_path, null: false, limit: 255
+ t.string :panel_xid, limit: 255
+ t.text :description, null: false, limit: 255
+
+ t.index %i(environment_id dashboard_path starting_at ending_at), where: 'environment_id IS NOT NULL', name: "index_metrics_dashboard_annotations_on_environment_id_and_3_col"
+ t.index %i(cluster_id dashboard_path starting_at ending_at), where: 'cluster_id IS NOT NULL', name: "index_metrics_dashboard_annotations_on_cluster_id_and_3_columns"
+ end
+ end
+end