Skip to main content

Introduction to the Report_Templates Table

The report_templates table is designed to store and manage various types of report templates within the Serial application. This table plays a crucial role in organizing, versioning, and controlling access to different reporting configurations across the system.

Table Structure

The report_templates table is structured to accommodate diverse report types while maintaining version control and access management. Here’s a detailed breakdown of its columns:

Usage and Functionality

The report_templates table is designed to be flexible and secure, accommodating various reporting needs within the Serial application. Here are some key points about its usage:
  1. Version Control: The table implements a revision system, allowing multiple versions of a template to be stored. The revision column, along with the is_latest_revision flag, helps manage different iterations of a template.
  2. Access Control: Through the is_public flag and the shared_with JSON column, the table provides granular control over who can access and use each template. This is further reinforced by row-level security policies.
  3. Template Diversity: The type column allows for different kinds of report templates, such as GridBuilderView, GraphBuilderView, SnLookupPdfTemplate, and Dashboard. The config JSON column stores the specific configuration for each template type.

Notes

  • The table uses triggers to automatically increment the revision number and update the last_edited_at timestamp when changes are made.
  • Row-level security is implemented with policies that restrict access based on user roles and company associations. For example:
  • The table has foreign key constraints linking to the companies and users tables, ensuring data integrity across the database.
By leveraging the report_templates table, the Serial application provides a robust and flexible system for creating, managing, and sharing various types of report templates across different companies and users, while maintaining version control and enforcing proper access restrictions.