Ash snapshot migration system

Hey @zachdaniel, I remember some time ago there was some discussion about changing the way Ash snapshot migration system worked. Is this something that are still in the roadmap?

Honestly, from my point of view, this is the last pain point that I can think when using Ash, all the rest has been a real pleasure, but the snapshot system gives some headache when developing a project with multiple developers.

What my team did before merging a new branch to master was to always remove all migration files and snapshots, making sure that the branch was up-to-date with master, recreate all migrations and then merge it. That way, the window to have conflicts with other branches would be limited.

That works, but it requires discipline which not everyone has, so it is not uncommon that people push migrations that would break some other snapshot and now we need to go there and fix it manually editing the json files.

The change to this system still hasn’t been started. There is some tooling you can try which I haven’t personally to help make this a bit better in the short term.

https://hexdocs.pm/ash_postgres/Mix.Tasks.AshPostgres.SquashSnapshots.html

That mix task could be put in your CI to check that there is only one latest snapshot at any one time. YMMV

3 Likes

Thanks for the tip! I will check it out

1 Like