Tables
Technical Details

Technical details for Tables used by dbOmnibus.

| Tables List |


Log

Store application logging entries.

Populated by: [sp_InsertLog]

@@@---@@@

This SQL script, t-Log, is responsible for creating and maintaining the persistent [dbo].[Log] table. This table is intended to store application-specific logging entries, providing a historical record of events within the dbOmnibus application.

Script Breakdown
1. Update Persistent Entity Version Record
Metadata Declaration:

SQL

DECLARE @Name [varchar](128),@Description [varchar](128),@Version [int],@Type [varchar](5);
SET @Version=240903;
SET @Type='T';
SET @Name= 'Log';
SET @Description= 'Store application logging entries';
These lines declare local variables and assign metadata related to the [dbo].[Log] table. Specifically, it sets the version of the Log table to 240903 (September 3, 2024).

EXEC [Deploy].[sp_UpdateEntityVer] @Type=@Type,@Name=@Name,@Description=@Description,@Version=@Version;: This statement calls the [Deploy].[sp_UpdateEntityVer] stored procedure. As analyzed previously, this procedure updates a temporary table (#EntityVers) with the version information for the Log table during the current deployment session. This temporary record will later be persisted to [dbo].[_EntityVersions] by [Deploy].[sp_SetEntityVersions].

GO: This separates the variable declarations and procedure call from the table creation block, ensuring they execute in distinct batches.

2. Table Creation ([dbo].[Log])
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Log]') AND type in (N'U')): This is a standard idempotent check. It ensures that the [dbo].[Log] table is only created if a user table with that name does not already exist in the dbo schema. This prevents errors if the script is run multiple times.

BEGIN CREATE TABLE [dbo].[Log]( ... ) ON [PRIMARY] END;: If the table does not exist, it is created with the following columns:

[Time] [datetime] NOT NULL: This column is intended to store the timestamp of the log entry. It is defined as NOT NULL, meaning every log entry must have a timestamp.

[Entry] [nvarchar](255) NULL: This column will store the actual log message or entry. It is defined as NULL, allowing for potentially empty messages (though typically log entries would have content). nvarchar is a good choice for log messages as it supports Unicode characters.

Purpose and Role in the Framework
The [dbo].[Log] table serves as the application's logging destination. Its primary purposes are:

Centralized Logging: Provides a dedicated table within the database for storing application events, errors, or informational messages.

Troubleshooting and Auditing: Allows administrators and developers to review historical application behavior for debugging, performance analysis, or auditing purposes.

Deployment Monitoring: During complex deployments, intermediate steps or significant events could be logged here to track progress or identify issues.

The comment "Populated by: [sp_InsertLog]" indicates that there's another stored procedure (likely [dbo].[sp_InsertLog]) that will be responsible for writing entries into this table. This modular approach is common in well-designed database applications.

This script demonstrates a basic, yet essential, component for any application: a persistent logging mechanism. By using the [Deploy] utilities, its creation and version tracking are integrated seamlessly into the overall deployment framework.

 


Page Last Updated: 11 July 2025