System fields
In undb, system fields are automatically generated when you create a new Table. These fields are essential for tracking and managing data within your Tables, providing metadata that helps ensure the integrity and traceability of your data.
Key Characteristics of System Fields
Automatic Creation
- Generated by Default: When you create a Table in undb, a set of system fields is automatically created. These fields are integral to the Table’s structure and function.
System-Managed Values
- System-Set Values: The values in system fields are managed by the undb system itself. For example, the
createdAt
field will automatically record the timestamp when a record is created, and theupdatedAt
field will update whenever a record is modified.
Visibility in Views
- Default Hidden: By default, system fields are not displayed in the Table views to avoid cluttering your data presentation with metadata.
- Toggle Visibility: However, you can choose to display these fields by adjusting the view settings. This allows you to see the system fields when needed, such as when auditing changes or tracking record creation times.
Immutable Fields
- Non-Removable: System fields cannot be deleted or recreated. They are a permanent part of the Table’s schema to ensure that essential data management functions are always available.
- Rename Option: While you cannot delete or recreate these fields, undb allows you to rename them to better fit the context of your project or to align with your preferred terminology.
List of System Fields
Here’s a brief overview of the common system fields in undb:
- id: A unique identifier for each record in the Table.
- autoIncrement: Automatically increments with each new record.
- createdAt: Records the timestamp when the record was created.
- createdBy: Indicates the user who created the record.
- updatedAt: Records the timestamp when the record was last updated.
- updatedBy: Indicates the user who last updated the record.
These fields provide critical information for managing your data and ensuring that each record is properly tracked and accounted for.
Managing System Fields
- Renaming Fields: If needed, you can rename these system fields to match your project’s conventions or preferences. This does not affect their functionality, only their label in the Table.
- Adjusting Visibility: Use the view settings to toggle the visibility of these fields based on your current needs. Whether for auditing purposes or regular use, you can control when and where these fields appear in your Table views.
By understanding and managing system fields effectively, you can ensure that your data in undb remains well-organized and that essential metadata is always available when needed.