diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-09-05 21:05:08 +0200 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-09-05 21:05:08 +0200 |
commit | 40181bfcab73b37e6b32fbaf8758aaeaa5157e2b (patch) | |
tree | 9a16ac44982cd0cc7271177ff00bf4bd7702012f /db | |
parent | bdb06db0f6543403b109827ae22478a5ed490403 (diff) | |
download | gitlab-ce-40181bfcab73b37e6b32fbaf8758aaeaa5157e2b.tar.gz |
Fix concurrent index problem
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20180831164908_add_identifier_to_prometheus_metric.1.rb (renamed from db/migrate/20180831164908_add_identifier_to_prometheus_metric.rb) | 1 | ||||
-rw-r--r-- | db/migrate/20180831164909_add_index_for_identifier_to_prometheus_metric.rb | 17 | ||||
-rw-r--r-- | db/migrate/20180831164910_import_common_metrics.rb (renamed from db/migrate/20180831164909_import_common_metrics.rb) | 0 | ||||
-rw-r--r-- | db/schema.rb | 2 |
4 files changed, 18 insertions, 2 deletions
diff --git a/db/migrate/20180831164908_add_identifier_to_prometheus_metric.rb b/db/migrate/20180831164908_add_identifier_to_prometheus_metric.1.rb index 129e4a6e7f5..67de990757e 100644 --- a/db/migrate/20180831164908_add_identifier_to_prometheus_metric.rb +++ b/db/migrate/20180831164908_add_identifier_to_prometheus_metric.1.rb @@ -7,6 +7,5 @@ class AddIdentifierToPrometheusMetric < ActiveRecord::Migration def change add_column :prometheus_metrics, :identifier, :string - add_index :prometheus_metrics, :identifier, unique: true end end diff --git a/db/migrate/20180831164909_add_index_for_identifier_to_prometheus_metric.rb b/db/migrate/20180831164909_add_index_for_identifier_to_prometheus_metric.rb new file mode 100644 index 00000000000..f41a869199a --- /dev/null +++ b/db/migrate/20180831164909_add_index_for_identifier_to_prometheus_metric.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIdentifierToPrometheusMetric < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :prometheus_metrics, :identifier, unique: true + end + + def down + remove_concurrent_index :prometheus_metrics, :identifier, unique: true + end +end diff --git a/db/migrate/20180831164909_import_common_metrics.rb b/db/migrate/20180831164910_import_common_metrics.rb index 72658c09b8e..72658c09b8e 100644 --- a/db/migrate/20180831164909_import_common_metrics.rb +++ b/db/migrate/20180831164910_import_common_metrics.rb diff --git a/db/schema.rb b/db/schema.rb index 5fa471a917f..333b40b34ce 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180831164909) do +ActiveRecord::Schema.define(version: 20180831164910) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" |