Skip to main content
The component_process_links table is designed to establish and maintain relationships between components and processes in the Serial database. This table plays a crucial role in organizing the workflow and structure of component processing within the system.

Table Structure

The component_process_links table is structured to efficiently link components to their associated processes while maintaining order and versioning information. Here’s a detailed breakdown of its columns:
Column NameData TypeConstraintsDescription
iduuidprimary key, default uuid_generate_v4()Unique identifier for each link
company_iduuidnot null, foreign keyReference to the company owning this link
component_iduuidnot null, foreign keyReference to the component being linked
process_iduuidnot null, foreign keyReference to the process being linked
orderbigintnot nullSpecifies the order of processes for a component
is_activebooleannot null, default trueIndicates whether the link is currently active
process_revisionbigintnot null, default 1Tracks the revision of the process in this link

Usage and Functionality

The component_process_links table is designed to be a flexible and powerful tool for managing the relationships between components and processes. Here are some key points about its usage:
  1. Active Link Management: The table allows for soft deletion of links through the is_active column, enabling historical tracking while maintaining current relationships.
  2. Process Ordering: The order column facilitates the sequencing of processes for a given component, allowing for structured workflows.
  3. Revision Tracking: By including the process_revision column, the table supports versioning of processes, ensuring that components are linked to the correct version of a process.
  4. Company-Specific Relationships: The inclusion of company_id ensures that links are properly segregated by company, supporting multi-tenant functionality.

Notes

  • The table is often queried to retrieve only active links of active components, excluding links to processes of type “Instantiation”. This can be seen in the following example:
    const { data, error } = await supabase
      .from("component_process_links")
      .select("*, component:component_id!inner(*), process:processes!inner(*)")
      .eq("component.is_active", true)
      .neq("process.type", ProcessType.Instantiation)
      .eq("is_active", true)
      .returns<ComponentProcessLink[]>();
    
  • The table is involved in transactional deletions of components, ensuring that all related links are properly removed when a component is deleted.
  • It plays a role in retrieving component genealogies, helping to establish the hierarchical relationships between components based on their associated processes.
  • The table is updated automatically when process revisions change, ensuring that links always reference the most up-to-date process information.
By leveraging the component_process_links table, the Serial application maintains a flexible and versioned structure for associating components with their relevant processes, enabling complex workflows and maintaining data integrity across the system.