Skip to main content
The unique_identifier_links table is designed to establish and manage relationships between unique identifiers in a hierarchical structure. This table plays a crucial role in tracking the assembly and disassembly of components, associating process entries with unique identifiers, and maintaining a historical record of these relationships.

Table Structure

The unique_identifier_links table is structured to capture the complex relationships between unique identifiers and their associated data. Here’s a detailed breakdown of its columns:
Column NameData TypeConstraintsDescription
iduuidprimary keyUnique identifier for each link
company_iduuidforeign keyReferences the company associated with the link
unique_identifier_iduuidforeign keyReferences the parent unique identifier
has_child_of_iduuidforeign keyReferences the child unique identifier
process_entry_iduuidforeign keyReferences the associated process entry
is_activebooleandefault trueIndicates whether the link is currently active
dataset_iduuidAssociates the link with a specific dataset
created_attimestamp with time zonenot null, default now()Timestamp of when the link was created
removed_attimestamp with time zonenullableTimestamp of when the link was removed (if applicable)
removed_by_user_iduuidforeign key, nullableReferences the user who removed the link (if applicable)
removal_reasontextnullableReason for removal of the link (if applicable)

Usage and Functionality

The unique_identifier_links table is designed to be flexible and informative, capturing the dynamic relationships between components. Here are some key points about its usage:
  1. Hierarchical Component Structure: The table allows for the creation of a hierarchical structure of components through the unique_identifier_id and has_child_of_id columns. This enables the system to track complex assemblies and sub-assemblies.
  2. Active Status Tracking: The is_active column allows for soft deletion of links. When a link is no longer valid, it can be marked as inactive rather than being permanently deleted, preserving the historical record.
  3. Removal Information: When a link is deactivated, the removed_at, removed_by_user_id, and removal_reason columns capture important metadata about the removal process, enhancing traceability.
  4. Process Association: Each link is associated with a specific process entry through the process_entry_id, allowing for detailed tracking of assembly or disassembly operations.

Notes

  • The table is used extensively in genealogy queries, such as in the sn_lookup_page function, to trace relationships between unique identifiers and construct component hierarchies.
  • Example usage in TypeScript:
    interface UniqueIdentifierLink {
      id: string;
      company_id: string;
      unique_identifier_id: string;
      has_child_of_id: string;
      process_entry_id: string;
      is_active: boolean;
      dataset_id: string;
      created_at: string;
      removed_at: string | null;
      removed_by_user_id: string | null;
      removal_reason: string | null;
    }
    
By leveraging the unique_identifier_links table, the Serial application can maintain a comprehensive and traceable record of component relationships, supporting complex genealogy queries and providing insights into the assembly and disassembly processes throughout a product’s lifecycle.