You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, as you might expect, actually attempting to insert/update a version fails because the item_id and originator_id in the version schema are still set to :integer:
I am new to Elixir, and less-than-confident in my ability to write a solid patch for this, but I'm happy to take a stab at it if you don't have the bandwidth or interest in working on it yourself.
The text was updated successfully, but these errors were encountered:
Hi Andy, thanks for reporting this interesting issue. I would say that current behavior is intentional. Error is related to the PaperTrail.Version Ecto model type for :item_id.
I've designed PaperTrail for versioning many types of models at once, you can try to implement UUID versioning however then all your tracked models primary keys should be UUIDs. This makes the scope of this feature very tiny. Feel free to take a stab at it, I will review and share my opinion, the worst case you can create your own fork of paper_trail and publish it as an individual package.
I've never used UUIDs as primary keys, never really had a good use case for it. PaperTrail actually uses Postgres Sequences for the version inserts on strict mode thus you will probably have to rewrite that part as well.
I'm hoping to use PaperTrail in a Phoenix project where all primary keys on database tables are UUIDs instead of integers.
Adapting the
add_versions
migration generated by PaperTrail to use UUIDs is fairly straightforward:However, as you might expect, actually attempting to insert/update a version fails because the item_id and originator_id in the version schema are still set to
:integer
:I would hope to be able to set the primary key type as a top-level configuration value to :paper_trail, e.g. something like this in
config.exs
:I am new to Elixir, and less-than-confident in my ability to write a solid patch for this, but I'm happy to take a stab at it if you don't have the bandwidth or interest in working on it yourself.
The text was updated successfully, but these errors were encountered: