GigCity Elixir wrapped, new AshEvents extension, "Domain Modeling with Ash Framework" book launch, c
Ash Weekly: Issue #16
GigCity Elixir wrapped, new AshEvents extension, "Domain Modeling with Ash Framework" book launch, combination query feature released.
26 Replies
I was about to go 'aaaaaaah' based on one line in the newsletter email but I see it's already been fixed in the online version 👍
Yeah someone messaged me that I had tripled my negative 😂
lol uh huh
our team was just looking to implement auditing in our app what nice timing 🙌
we tried ash_paper_trail but it does not include the actor in the same was as this
what is the right way to handle the migrations?
our app atm has no automatic migrations, we are managing the SQL directly with an external team. Is it ok to just create the table manually from this? https://github.com/ash-project/ash_events/blob/main/priv/test_repo/migrations/20250417180632_migrate_resources1.exs#L76
(changing the record_id type to text because legacy ids are not uuid 🫠)
also is there any way to define which attribute we want to set in the actor? i see it grabs the primary key but in our case it doesnt work in some actors
we have these types of actors:
and im seeing in the docs that maybe we did not define our actors properly and it should be two different resources then 🤔. the :user type is the one that has an user_uuid pk, the other types of actors are support users so we did not bother with ids, we have emails
idk if this is the right place to have these discussions mb if not 🙏
Newsletter only designed for dark mode 😅
all the cool kids use dark mode
Oh does it look wrong 😅 whoops
@Ahrou id suggest opening issues on the project
It's a new thing and only just got its 0.1 release so may be a bunch of things to work out based on how others want to use it
will create issues then thanks 🙏
it's white lettering on a white background

🥹
@Ahrou just FYI: if all you want is an audit trail, you should IMO use
ash_paper_trail
you can persist the actor
but ash_events
comes with tradeoffs/limitations you have to agree to to use it.i read the differences here https://github.com/ash-project/ash_events?tab=readme-ov-file#differences-from-ash_paper_trail-with-regards-to-audit-logging
and we were more inclined in using AshEvents, we want a single table and only the changes saved. I dont think we would need
options for change tracking and storing action inputs
GitHub
GitHub - ash-project/ash_events: An event-architecture extension fo...
An event-architecture extension for Ash. Contribute to ash-project/ash_events development by creating an account on GitHub.
Right, but you also need to consider the constraints
GitHub
GitHub - ash-project/ash_events: An event-architecture extension fo...
An event-architecture extension for Ash. Contribute to ash-project/ash_events development by creating an account on GitHub.
But yeah, if you want one event log etc then perhaps that is your best bet 🤷♂️
i see, hadnt looked at that section since we are not planning to have complete events, we followed the section
Using AshEvents for Audit Logging Only
so in the audit logs only case that wouldnt be an issue?Um...yeah possibly actually
you're probably right
if you don't want replay, you don't have to follow all the caveats.
It looks like
paper_trail
provides the opts necessary to have a single Version
resource that stores entries from multiple resources. If this is incorrect, feel free to correct me.I believe you could, yes
i tried paper_trail last week, and correct me if im wrong, but i think there is no
resource
column, so we would not be able to distinguish them easilyYou could use the version mixin to give them all the same table
from what i could see while testing it, this is the table for _versions right?
if we store every Resource in this table, there is no
resource
column to filter them, like in AshEvents right?Correct, but we could add an option store something like that.
Not pushing you to use it though
An interesting overlap at the end of the day
then we could use ash_paper_trail, there was just another issue, the version_source_id type is different in many resources from uuid to integer, to varchar 🫠 maybe i will discuss with the team if we want to have a single table for each resource 🤔
There's a couple options for storing the resource identifer too

Try setting
store_resource_identifier?: true
to see if it adds a column to the table and stores the resource's short_name.
Also, we should probably move this conversation to https://discord.com/channels/711271361523351632/1253438465543245844