Skip to content

Extension Proposal: [Change tracking via Carbonite] #456

@terrisgit

Description

@terrisgit

** What is the purpose of the extension? **

Track changes to resources that are stored in Postgres tables using the bitcrowd/carbonite project. (Only Postgres 13 and higher are supported.) See https://hexdocs.pm/carbonite/Carbonite.html for the list of benefits and how it works.

** How would it extend the DSL? **

I am open to suggestions. In my case every resource would be tracked but in the general case only certain resources should be tracked.
"track changes with carbonite"

** What it would do? **

  1. Would these be manual tasks?

A) Add Carbonite dependencies. See https://hexdocs.pm/carbonite/Carbonite.html#module-hex-dependency

B) Create a migration to add the carbonite schema if it doesn't already exist. Perhaps the dsl should accept an optional schema name. See https://hexdocs.pm/carbonite/Carbonite.html#module-creating-the-initial-migration

  1. Create a migration to add triggers to the table for cud operations - see https://hexdocs.pm/carbonite/Carbonite.html#module-trigger-configuration

  2. Alter all cud operations to create a Carbonite transaction row. See https://hexdocs.pm/carbonite/Carbonite.html#module-inserting-a-transaction

** Interaction with other features **

  1. Tenants - does each tenant get its own carbonite schema?

  2. Context - I want to associate current_user.id with the Carbonite transaction. However, some operations will be done anonymously

  3. Archive - unclear whether anything special is needed

  4. Seed data (if applicable). Ash would either insert a transaction for Carbonite or disable the validation. See https://hexdocs.pm/carbonite/Carbonite.html#module-inserting-a-transaction

  5. Migrations. Similarly, if migrations alter data, Ash would either insert a transaction for Carbonite or disable the validation. See https://hexdocs.pm/carbonite/Carbonite.html#module-transactions-in-data-migrations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions