Change Tracking Details


Introduction

Helium features a strategy for change tracking in the app persistence tier. This is provided for all model objects in an app by default. This document provides a brief description thereof. 



Design

Helium makes use of various database triggers and tables in app schemas to facilitate change tracking. These tables and functions are described below.

TableTables / Function
__he_sync_transaction_log__Keeps track of transactions during which data were changed in Helium. This table is not populated when changes do not flow via the Helium platform, but is not required to be populated for synchronisation (Journey + Helium Android) to work properly.
__he_sync_obj_change__Keeps track of create, update & delete changes to records. link & unlink of relationships, excluding many-to-many relationships, are tracked as create or update, depending on when they occur.
__he_sync_client__Keeps track of Helium Android synchronisation clients - app / role / user / device combinations
__he_sync_client_request_log__Keeps track of Helium Android synchronisation requests
__he_sync_many_to_many_unlink__Tracks unlink changes to many-to-many relationships
<table>._tx_id_Tracks the transaction ID during which the record was last changed. This ID will be the same as the ID from __he_sync_transaction_log__ when the transaction is recorded in the __he_sync_transaction_log__ by Helium. This column will still be populated when changes are made directly in the database, but the __he_sync_transaction_log__ entries will be absent. It is therefore important to realise that not all transaction IDs can be joined to the __he_sync_transaction_log__ table.
<table>._change_type_Tracks whether the last change to the record was a create or and update change.
<table>._change_seq_Tracks the sequential number (within the specific app's schema) for the last change that affected the record
__he_sync_obj_insert_after__Function that records create __he_sync_obj_change__ for records. Triggers, calling this function, with the same name exist for all object types (except those marked with @NotTracked) in the data model.
__he_sync_obj_update_before__Function that updates <table>._tx_id_, <table>._change_type_ and <table>._change_seq_ Triggers, calling this function, with the same name exist for all object types in the data model.
__he_sync_obj_update_after__Function that records update __he_sync_obj_change__ for records. Triggers, calling this function, with the same name exist for all object types (except those marked with @NotTracked) in the data model.
__he_sync_obj_delete_after__Function that records delete __he_sync_obj_change__ for records. Triggers, calling this function, with the same name exist for all object types (except those marked with @NotTracked) in the data model.
__he_sync_<table>_insert_after__Function that records update __he_sync_obj_change__ for records owning many-to-many relationships. Triggers, calling this function, with the same name exist for all many-to-many relationships (except those belonging to object types marked with @NotTracked) in the data model.
__he_sync_<table>_delete_after_a__Function that records __he_sync_many_to_many_unlink__ for many-to-many relationships. Triggers, calling this function, with the same name exists for all many-to-many relationships (except those belonging to object types marked with @NotTracked) in the data model.
__he_sync_<table>_delete_after_a__Function that records update __he_sync_obj_change__ for records owning many-to-many relationships. Triggers, calling this function, with the same name exist for all many-to-many relationships (except those belonging to object types marked with @NotTracked) in the data model.
__he_data_version__Tracks the version of the schema. This version number is a hash generated by Helium and should not be used in any other way than to determine if two versions are the same.
__he_meta_data_version__Tracks the meta data version of the schema - currently that is the version of change tracking present in the schema.




Related Documentation

Change tracking in app schemas is also used to facilitate automatic schema migration during app upgrades. This is described in more detail here.