-
Notifications
You must be signed in to change notification settings - Fork 0
Metadata
The irontrail_changes table has a column named metadata of type JSONB which can store any sort of data.
Metadata on the Ruby side is stored in IronTrail::Current#metadata hashmap and it's serialized to JSON before being sent to Postgres.
You can use any key name you like, but a few names are processed in a special way by IronTrail, see the Special keys section down below. Also, avoid using key names prefixed by an underscore (_).
These are all metadata key names that have special meaning to IronTrail:
_actor_type_actor_id_db_created_at
The _actor_type and _actor_id, when populated, will be moved from the metadata column into their own columns in the irontrail_changes, which are the actor_type and actor_id column.
The _db_created_at key will be populated in case the change record creation date was determined by the trigger function. Read more about created_at in change record.
If you're using Sidekiq, you may want to use the IronTrail::SidekiqMiddleware. When enabled, it will automatically inject metadata about the sidekiq job being run.
The injected keys are:
-
job.jidSidekiq's Job ID -
job.classThe job class name -
job.queueThe sidekiq queue name -
job.bidThe sidekiq batch ID. This is only present when the job runs in a batch