Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20200820204041_create_ci_platform_metrics.rb')
-rw-r--r--db/migrate/20200820204041_create_ci_platform_metrics.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/db/migrate/20200820204041_create_ci_platform_metrics.rb b/db/migrate/20200820204041_create_ci_platform_metrics.rb
new file mode 100644
index 00000000000..27a5a3dc8eb
--- /dev/null
+++ b/db/migrate/20200820204041_create_ci_platform_metrics.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class CreateCiPlatformMetrics < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ CI_VARIABLES_KEY_INDEX_NAME = "index_ci_variables_on_key"
+
+ disable_ddl_transaction!
+
+ def up
+ unless table_exists?(:ci_platform_metrics)
+ create_table :ci_platform_metrics do |t|
+ t.datetime_with_timezone :recorded_at, null: false
+ t.text :platform_target, null: false
+ t.integer :count, null: false
+ end
+ end
+
+ add_text_limit :ci_platform_metrics, :platform_target, 255
+ add_concurrent_index :ci_variables, :key, name: CI_VARIABLES_KEY_INDEX_NAME
+ end
+
+ def down
+ if table_exists?(:ci_platform_metrics)
+ drop_table :ci_platform_metrics
+ end
+
+ remove_concurrent_index :ci_variables, :key, name: CI_VARIABLES_KEY_INDEX_NAME
+ end
+end