Commit 8130d702 authored by Hordur Freyr Yngvason's avatar Hordur Freyr Yngvason Committed by Tiger Watson

Backfill clusters_integration_elastic_stack.enabled

parent af8d6a2e
---
title: Backfill clusters_integration_elastic_stack.enabled
merge_request: 61521
author:
type: changed
# frozen_string_literal: true
class BackfillClustersIntegrationElasticStackEnabled < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
def up
ApplicationRecord.connection.execute(<<~SQL.squish)
INSERT INTO clusters_integration_elasticstack(
cluster_id,
enabled,
chart_version,
created_at,
updated_at
)
SELECT
cluster_id,
true,
version,
TIMEZONE('UTC', NOW()),
TIMEZONE('UTC', NOW())
FROM clusters_applications_elastic_stacks
WHERE status IN (3, 11)
ON CONFLICT(cluster_id) DO UPDATE SET
enabled = true,
updated_at = TIMEZONE('UTC', NOW())
SQL
end
def down
# Irreversible
end
end
212a2db8b1183eb4ae313eacae7d54f2bec26c5ea3f961981d34e57ca1420ad9
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment