db/migrate/20210311092612_update_centralisation_metadata.rb
#
# This task is only needed to "backport" the new metadata attribute `centralised`, to the
# already centralised courts that took part starting 02 Mar 2021 09:00:00, in the first rollout.
#
# This is needed as the metadata was not created back then. New completions on or after this
# migration will already include the `centralised` attribute (true/false).
#
This task is only needed to "backport" the new metadata attribute `centralised`, to the
already centralised courts that took part starting 02 Mar 2021 09:00:00, in the first rollout.

This is needed as the metadata was not created back then. New completions on or after this
migration will already include the `centralised` attribute (true/false).
This task is only needed to " backport " the new metadata attribute ` centralised ` to the already centralised courts that took part starting 02 Mar 2021 09 : 00 : 00 in the first rollout . This is needed as the metadata was not created back then . New completions on or after this migration will already include the ` centralised ` attribute ( true / false ) .
def up
    CompletedApplicationsAudit.where(
      'completed_at >= :date', date: FIRST_BATCH_DATE
    ).where(court: FIRST_BATCH_COURTS).each do |record|
      record.update_column(:metadata, record.metadata.merge(centralised: true))
    end
  end
def up CompletedApplicationsAudit . where ( 'completed_at >= :date' , date : FIRST_BATCH_DATE ) . where ( court : FIRST_BATCH_COURTS ) . each do | record | record . update_column ( :metadata , record . metadata . merge ( centralised : true ) ) end end
This task is only needed to "backport" the new metadata attribute `centralised`, to the
already centralised courts that took part starting 02 Mar 2021 09:00:00, in the first rollout.
This task is only needed to " backport " the new metadata attribute ` centralised ` to the already centralised courts that took part starting 02 Mar 2021 09 : 00 : 00 in the first rollout .