Commit 4ef07e3f authored by Rémy Coutable's avatar Rémy Coutable

Use the Gitlab::Database::AsWithMaterialized helper for PG11 support

Changelog: fixed
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent b9827905
......@@ -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