north_celt
I’m trying to implement a feature in my LiveView app that shows “activity” for that record such as changes and comments. Ideally, any changes will show the before/after values in an easy-to-read format, similar to git commit changes. Here’s an example from Airtable:
I’m wondering if there are any libraries that can help me with this, or if it’s something I’ll have to tackle all from scratch? There are quite a lot of models in my app that I need this form of paper-trail tracking implemented for, so just doing it as a feature per model seems like a bad approach.
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m aware of 2 such projects, are there others?
git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
Hi all,
I’m working on a Phoenix project where I need to make external HTTP requests and I’m trying to choose between Req and HTTPoison....
New
Hi everyone.
My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
Hi,
we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
Hi all, I’m new here and would like to hear peoples views on my Elixir/Phoenix based game-engine! :smiley:
Mutonex gamedesign was finish...
New
Do we have maintainer of absinthe-graphql/dataloader here? We have a PR that we’d like to merge to the library. Relatively small additive...
New
Other Trending Topics
Hey there,
I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first.
...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly)
AI dream has many faces, but general...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixirconf-us
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #hex












Showing Posts 1 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
evadne
The most righteous solution, if you are using Postgres, would be to implement a trigger function which writes the changes to a separate table.
Otherwise you would be at the mercy of the application code actually logging 100% of the time.
north_celt
Well, obviously I’m not much for being righteous because I’m using SQLite for storage on this app (for a lot of other very good reasons)
khedaywi
Assuming you’re using Ecto to manage your data schemas, you could utilize a library like ecto_diff to determine the differences between ecto structs, then build a simple model to record the lifecycle changes.
hst337
You can use something like
greven
There is also paper_trail.
warmwaffles
The thing about using
paper_trailis that if you have a mixture of PKs that are integers and uuids, you need two version tables to track them. It’s best to pick one format and stick with it and pray you never change.I haven’t tried it with tracking compound pk entities, but I suspect it is also problematic.
north_celt
Thanks, and then I’d just wrap each context that needs a diff with a transaction that saved both the diff and the model?
north_celt
Paper trail seems interesting, I’m not sure that I necessarily need to keep every historical version of every record. I’m thinking maybe I can just make a Ecto Repo that has
Repo.insert()andRepo.update()insert “changes” into the database in a transaction