# `MishkaBlog.Resources.Mixins.PaperTrailMixin`
[🔗](https://github.com/mishka-group/mishka_blog/blob/v0.0.1/lib/mishka_blog/resources/__mixins/paper_trail_mixin.ex#L5)

The version resource a PaperTrail-tracked blog resource keeps its history in: the table, its
foreign key to the record, and the actions and policies that read the history.

    paper_trail do
      mixin {MishkaBlog.Resources.Mixins.PaperTrailMixin, :postgres, ["mishka_blog_tag_versions"]}
    end

The versions are global rather than per site, so a record's history can be read across sites by a
master. The foreign key cascades, so deleting the record deletes its versions.

The version resource gets these read actions, all bypassing the tenant:

* `:get_any` - One version by id.
* `:read_any` - Every version.
* `:sorted_versions` - Every version, newest first, paginated.

A version holds a full copy of its record, drafts included, so it is for an admin however it is
reached, the record's own history included: a master reads every site's, a site's admin its own
site's. A call made with `authorize?: false` is not checked.

# `postgres`

```elixir
@spec postgres(String.t()) :: Macro.t()
```

The version resource's DSL for `table`, as quoted code the mixin expands into the resource.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
