Introduction to the label_elements Table
The label_elements table is designed to store information about individual elements within label designs. This table plays a crucial role in the Serial application’s labeling system by maintaining detailed data for various types of label components, such as text, images, barcodes, QR codes, and identifiers.Table Structure
The label_elements table is structured to capture the diverse attributes of different label element types. Here’s a detailed breakdown of its columns:| Column Name | Data Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | Unique identifier for each label element |
| label_format_id | uuid | foreign key | References the associated label format |
| company_id | uuid | foreign key | References the company owning the element |
| type | varchar(50) | check (‘BARCODE’, ‘QR_CODE’, ‘IDENTIFIER’, ‘TEXT’, ‘IMAGE’) | Type of the label element |
| x | float | Horizontal position in mm (absolute position only) | |
| y | float | Vertical position in mm (absolute position only) | |
| text | text | Content for TextElement | |
| font_size | float | Font size for TextElement and IdentifierElement | |
| bold | boolean | Bold style for TextElement | |
| italic | boolean | Italic style for TextElement | |
| underline | boolean | Underline style for TextElement | |
| file_id | uuid | References the associated file for ImageElement | |
| width | float | Width in mm for ImageElement, BarcodeElement, and QrCodeElement | |
| height | float | Height in mm for BarcodeElement |
Usage and Functionality
The label_elements table is designed to be flexible and accommodate various types of label elements. Here are some key points about its usage:- Element Type Diversity: The table supports multiple element types (Text, Image, Barcode, QR Code, Identifier) through the ‘type’ column, allowing for versatile label designs.
- Position and Sizing: The ‘x’ and ‘y’ columns define the element’s position on the label, while ‘width’ and ‘height’ specify dimensions for applicable element types.
- Text Formatting: For text elements, the table stores formatting information such as font size, bold, italic, and underline styles.
- Company-Specific Data: The ‘company_id’ column ensures that label elements are associated with specific companies, supporting multi-tenant functionality.
Notes
-
The LabelElementType enum in TypeScript corresponds to the ‘type’ column in this table:
- The label_elements table works in conjunction with the label_formats table to create complete label designs.

