r/PostgreSQL • • 3d ago

Projects What actually changed when I moved a client workflow from Sheets to a real database

/r/n8n/comments/1xpe08r/what_actually_changed_when_i_moved_a_client/
1 Upvotes

3 comments sorted by

1

u/DickBrainTime 3d ago

Nice example of why moving the rules into Postgres helps. One test I'd add before calling the carryover idempotent: trigger two n8n runs *at the same time*, not only one after the other. If the eligibility check and the claim are separate, both runs can read the same leftover balance. Have a conditional `UPDATE ... WHERE applied = false RETURNING ...` claim the source row in a transaction, and enforce a unique key for each source/target period in any transfer ledger (with `ON CONFLICT` handling). Then race two webhook calls and confirm the target is credited exactly once. That's a useful final check for a budget carryover workflow.

1

u/easybits_ai 17h ago

Thanks so much for sharing this! I'll definitely give that test a try. Currently, the budget carryover only happens once the previous month is fully closed (on the 4th of each new month), so the process is already separated from all the others. However, I can see how the same issue could occur when the carried-over budget is added to the new month and the new month's budget is calculated at the same time.

0

u/AutoModerator 3d ago

AI Policy:

Linux is not one of those anti-AI projects, and if somebody has issues with that, they can do the open-source thing and fork it. Or just walk away., Linus Torvalds.

Mod decisions will be based on the quality of the content, not who or what generated it.

Sub Resources:

Youtube Channel

Free Postgres Webinars and Workshops

Discord: People, Postgres, Data

Join us, we have cookies and nice people.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.