-
Notifications
You must be signed in to change notification settings - Fork 12
Use on conflict instead of replacing payment table rows #456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
1f70fc6 to
8dd65ba
Compare
JssDWt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
| lnurl_pay_info=COALESCE(excluded.lnurl_pay_info, payment_metadata.lnurl_pay_info), | ||
| lnurl_withdraw_info=COALESCE(excluded.lnurl_withdraw_info, payment_metadata.lnurl_withdraw_info), | ||
| lnurl_description=COALESCE(excluded.lnurl_description, payment_metadata.lnurl_description)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we setting here or partially updating? Asking because the name of the function implies setting but seems like existing values that are not updated are not being overridden anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, the name is inconsistent now as we only take the updated value if its not null. I'm fine reverting this for set_payment_metadata. I think the most important are the handling of payment and payment details related tables. Wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
roeierez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
0823ef4 to
08dd127
Compare
Updates the persistence of payments to use "ON CONFLICT" instead of "OR REPLACE" to avoid payment and foreign table rows being dropped when a payment is updated. For example spark invoice details or HTLC statuses are persisted between payment updates. This allows syncing payment data from multiple sources without losing data (e.g. syncing data from spark and flashnet) or storing a payment with non spark data before the initial transfer is synced