Introduction to the Unique_Identifier_Links Table
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 Name | Data Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | Unique identifier for each link |
| company_id | uuid | foreign key | References the company associated with the link |
| unique_identifier_id | uuid | foreign key | References the parent unique identifier |
| has_child_of_id | uuid | foreign key | References the child unique identifier |
| process_entry_id | uuid | foreign key | References the associated process entry |
| is_active | boolean | default true | Indicates whether the link is currently active |
| dataset_id | uuid | Associates the link with a specific dataset | |
| created_at | timestamp with time zone | not null, default now() | Timestamp of when the link was created |
| removed_at | timestamp with time zone | nullable | Timestamp of when the link was removed (if applicable) |
| removed_by_user_id | uuid | foreign key, nullable | References the user who removed the link (if applicable) |
| removal_reason | text | nullable | Reason 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:-
Hierarchical Component Structure: The table allows for the creation of a hierarchical structure of components through the
unique_identifier_idandhas_child_of_idcolumns. This enables the system to track complex assemblies and sub-assemblies. -
Active Status Tracking: The
is_activecolumn 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. -
Removal Information: When a link is deactivated, the
removed_at,removed_by_user_id, andremoval_reasoncolumns capture important metadata about the removal process, enhancing traceability. -
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_pagefunction, to trace relationships between unique identifiers and construct component hierarchies. -
Example usage in TypeScript:

