Change Tracking Details
- Jacques Marais
Owned by Jacques Marais
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.
Table | Tables / 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.