diff options
Diffstat (limited to 'db/migrate/20200406102111_add_index_to_deployments_where_cluster_id_is_not_null.rb')
-rw-r--r-- | db/migrate/20200406102111_add_index_to_deployments_where_cluster_id_is_not_null.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20200406102111_add_index_to_deployments_where_cluster_id_is_not_null.rb b/db/migrate/20200406102111_add_index_to_deployments_where_cluster_id_is_not_null.rb new file mode 100644 index 00000000000..67ffba6af5e --- /dev/null +++ b/db/migrate/20200406102111_add_index_to_deployments_where_cluster_id_is_not_null.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexToDeploymentsWhereClusterIdIsNotNull < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :deployments, :id, where: 'cluster_id IS NOT NULL', name: 'index_deployments_on_id_where_cluster_id_present' + end + + def down + remove_concurrent_index :deployments, :id, where: 'cluster_id IS NOT NULL', name: 'index_deployments_on_id_where_cluster_id_present' + end +end |