gitlab-org--gitlab-foss/db/post_migrate/20220322132242_update_pages_onboarding_state.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
660 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class UpdatePagesOnboardingState < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
BATCH_SIZE = 75
def up
define_batchable_model(
:project_pages_metadata
).where(
deployed: true
).each_batch(
of: BATCH_SIZE,
column: :project_id
) do |batch|
batch.update_all(onboarding_complete: true)
end
end
def down
define_batchable_model(
:project_pages_metadata
).where(
onboarding_complete: true
).each_batch(
of: BATCH_SIZE,
column: :project_id
) do |batch|
batch.update_all(onboarding_complete: false)
end
end
end