A customer disputed a refund on our marketplace. The orders row said status = 'completed' and the total was correct. Then the questions arrived. Was the order ever cancelled and reopened? Who changed the shipping address, and was it before or after payment? Did support or the customer trigger the refund? Our database could answer none of them. Every value in it was correct, and it still could not explain what had happened. That is a data modeling problem, not a query problem. A table that only s...
Current state is right but history is lost: audit and history data modeling patterns
An order says COMPLETED, but nobody can say what it was before, who changed it, or when. We compare status history tables, trigger-based audit logs, temporal rows and event sourcing, with a runnable Postgres example and the rule we use to pick one.
This is a paid story
Subscribe to read the full content, access all paid stories, and support the authors.
Add a label
Embed this post
<iframe src="https://www.hibug.me/audit-history-data-modeling-patterns" width="700" height="420" frameborder="0" loading="lazy"></iframe>
I am a Senior Software Engineer with over a decade of hands-on experience building, scaling, and maintaining complex systems across the full stack—spanning frontend, backend, and DevOps. Over the last 10 years, I have navigated diverse architectures and untangled some of the most frustrating, elusive bugs in production. I believe that every production incident is a massive learning opportunity. Having discovered hibug.me, I am excited to contribute to this knowledge base, breaking down root causes, and sharing verified fixes to help fellow developers debug faster and build more resilient systems.
Comments
0No comments yet. Be the first to comment!
Sign In to post a comment.