Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions app/jobs/one_time_jobs/backfill_deposited_state_for_invoices.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

class BackfillDepositedStateForInvoices < ApplicationJob
queue_as :default

def perform
Invoice.find_in_batches(batch_size: 100) do |batch|
batch.each do |invoice|
if invoice.deposited?
invoice.update_column(:aasm_state, :deposited_v2)
end
end
end
end

end
17 changes: 17 additions & 0 deletions db/migrate/20250918021841_migrate_invoice_states_to_aasm.rb
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this file be deleted?

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class MigrateInvoiceStatesToAasm < ActiveRecord::Migration[7.2]
disable_ddl_transaction!

def up
Invoice.find_in_batches(batch_size: 100) do |batch|
batch.each do |invoice|
if invoice.deposited?
invoice.update_column(:aasm_state, :deposited_v2)
end
end
end
end

def down
raise ActiveRecord::IrreversibleMigration
end
end
Loading