Skip to content

Commit

Permalink
SU-555: Update last accrual date for migrated loans
Browse files Browse the repository at this point in the history
  • Loading branch information
hagafrank committed Jan 7, 2025
1 parent de8a952 commit e9b931d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scripts/sumas_migration_script.sql
Original file line number Diff line number Diff line change
Expand Up @@ -647,3 +647,14 @@ select count(*), blocking_reason_id from m_client group by blocking_reason_id;

-- Update office id back to 1 for all clients
update m_client set office_id = 1;

-- Update accural till date based on last payment date
update m_loan ml
set accrued_till = txn.last_payment_date
from
(
select MAX(transaction_date) last_payment_date, loan_id from m_loan_transaction mlt
where mlt.transaction_type_enum = 2 and mlt.is_reversed = false
group by loan_id
) txn
where ml.id = txn.loan_id

0 comments on commit e9b931d

Please sign in to comment.