Skip to main content

Introduction to the UNIQUE_IDENTIFIER_ACTIVITY_LOG Table

The UNIQUE_IDENTIFIER_ACTIVITY_LOG table is designed to track activity logs associated with unique identifiers. This table plays a crucial role in maintaining a comprehensive record of actions and changes related to unique identifiers within the Serial system.

Table Structure

The UNIQUE_IDENTIFIER_ACTIVITY_LOG table is structured to capture detailed information about each activity log entry. Here’s a detailed breakdown of its columns:
Column NameData TypeConstraintsDescription
iduuidprimary keyUnique identifier for each activity log entry
unique_identifier_iduuidforeign keyReference to the associated unique identifier
user_iduuidforeign keyID of the user who performed the action
company_iduuidforeign keyID of the company associated with the action
timestamptimestampnot nullTimestamp of when the activity occurred
actiontextnot nullDescription of the action performed

Usage and Functionality

The UNIQUE_IDENTIFIER_ACTIVITY_LOG table is designed to be a comprehensive audit trail for unique identifier-related activities. Here are some key points about its usage:
  1. Tracking Changes: The table records various actions performed on unique identifiers, allowing for a detailed history of modifications and interactions.
  2. User Accountability: By linking each entry to a specific user and company, the system maintains accountability for all actions taken on unique identifiers.
  3. Time-based Analysis: The timestamp column enables temporal analysis of activities, which can be useful for auditing and understanding usage patterns over time.

Notes

  • The table uses UUIDs for primary and foreign keys, ensuring unique identification across the system.
  • An index on the unique_identifier_id column is created to optimize queries filtering or joining on this field.
  • Row-level security policies are implemented to control access for authenticated users. For example:
    CREATE POLICY "Users can view activity logs for their company."
      ON public.unique_identifier_activity_log
      FOR SELECT
      USING (
        auth.uid() IN (
          SELECT supabase_uid
          FROM privileges
          WHERE company_id = unique_identifier_activity_log.company_id
        )
      );
    
  • Similar policies exist for insert, update, and delete operations, with additional checks for admin roles where necessary.
By leveraging the UNIQUE_IDENTIFIER_ACTIVITY_LOG table, the Serial application maintains a secure, detailed, and easily auditable record of all activities related to unique identifiers, enhancing traceability and accountability within the system.