Commit 25423897 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '333150-flaky-test-spec-lib-gitlab-background_migration' into 'master'

Use the Gitlab::Database::AsWithMaterialized helper for PG11 support [RUN ALL RSPEC]

See merge request gitlab-org/gitlab!63662
parents c87f2d89 4ef07e3f
......@@ -18,7 +18,7 @@ module Gitlab
def perform(from_id, to_id)
ContainerExpirationPolicy.where(enabled: true, project_id: from_id..to_id).each_batch(of: BATCH_SIZE) do |batch|
sql = <<-SQL
WITH batched_relation AS MATERIALIZED (#{batch.select(:project_id).limit(BATCH_SIZE).to_sql})
WITH batched_relation AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} (#{batch.select(:project_id).limit(BATCH_SIZE).to_sql})
UPDATE container_expiration_policies
SET enabled = FALSE
FROM batched_relation
......
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