FINERACT-2598: Backfill repaymentStartDateType values from loan product to loan level - Part 2#5826
Conversation
|
|
||
| SET v_rows_updated = ROW_COUNT(); | ||
| COMMIT; | ||
| DO SLEEP(0.1); |
|
|
||
| EXIT WHEN v_rows_updated = 0; | ||
| COMMIT; | ||
| PERFORM pg_sleep(0.1); |
There was a problem hiding this comment.
Done, removed the sleeps in both changeSets. Thanks!
…ct to loan level - Part 2
f688499 to
cb033bd
Compare
| </and> | ||
| </preConditions> | ||
| <sql splitStatements="false"> | ||
| DO $$ |
There was a problem hiding this comment.
Does PostgreSQL allow COMMIT inside DO $$ blocks?
Just checking because I thought transaction control inside anonymous blocks could fail.
There was a problem hiding this comment.
Yes, since PostgreSQL 11, COMMIT and ROLLBACK inside DO blocks is allowed https://www.postgresql.org/docs/current/plpgsql-transactions.html when they aren’t nested in an outer transaction . That’s why this changeSet uses runInTransaction="false". Also I tested it locally, and for me migration went well on both postgres and mysql
There was a problem hiding this comment.
Hi, thanks for replying, pls resolve this comment when it gets reviewed by adam
If possible can you share any data snapshot in which I can test these too?
Asking for myself so that I can fiddle around with schema locally.
There was a problem hiding this comment.
Hello, no problem - i’ll resolve it once Adam takes a look.
I don’t really have a data snapshot to share, but easiest thing is: on the code base without migration from this PR to just run the e2e tests for loans (from fineract-e2e-tests-runner - any of the loan features), they’ll create a bunch of records in m_loan for you. After that you can null out repayment_start_date_type_enum for some of them to simulate the pre-backfill state and run the migration to see it in action.
Description
Describe the changes made and why they were made. (Ignore if these details are present on the associated Apache Fineract JIRA ticket.)
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Your assigned reviewer(s) will follow our guidelines for code reviews.