Member Junction
    Preparing search index...

    Configuration options for SQL logging sessions

    interface SqlLoggingOptions {
        batchSeparator?: string;
        defaultSchemaName?: string;
        description?: string;
        filterByUserId?: string;
        filterPatterns?: (string | RegExp)[];
        filterType?: "include" | "exclude";
        formatAsMigration?: boolean;
        logRecordChangeMetadata?: boolean;
        prettyPrint?: boolean;
        retainEmptyLogFiles?: boolean;
        sessionName?: string;
        statementTypes?: "queries" | "mutations" | "both";
        variableBatchThreshold?: number;
        verboseOutput?: boolean;
    }
    Index

    Properties

    batchSeparator?: string

    Optional batch separator to emit after each statement (e.g., "GO" for SQL Server)

    defaultSchemaName?: string

    Optional default schema name to use for Flyway migrations for replacing schema names with the placeholder ${flyway:defaultSchema}

    description?: string

    Optional description to include as a comment at the start of the log

    filterByUserId?: string

    Optional user ID to filter SQL logging - only log SQL executed by this user

    filterPatterns?: (string | RegExp)[]

    Array of patterns to filter SQL statements. Supports both regex (RegExp objects) and simple wildcard patterns (strings). How these patterns are applied depends on filterType.

    String patterns support:

    • Simple wildcards: "AIPrompt", "spCreate*", "*Run"
    • Regex strings: "/spCreate.*Run/i", "/^SELECT.*FROM/i"

    RegExp examples:

    • /spCreateAIPromptRun/i - Match stored procedure calls
    • /^SELECT.*FROM.*vw.*Metadata/i - Match metadata view queries
    • /INSERT INTO EntityFieldValue/i - Match specific inserts
    filterType?: "include" | "exclude"

    Determines how filterPatterns are applied:

    • 'exclude': If ANY pattern matches, the SQL is NOT logged (default)
    • 'include': If ANY pattern matches, the SQL IS logged

    Note: If filterPatterns is empty/undefined, all SQL is logged regardless of filterType.

    formatAsMigration?: boolean

    Whether to format output as a flyway migration file with schema placeholders

    logRecordChangeMetadata?: boolean

    Whether to log record change metadata wrapper SQL (default: false). When false, only core spCreate/spUpdate/spDelete calls are logged

    prettyPrint?: boolean

    Whether to pretty print SQL statements with proper formatting

    retainEmptyLogFiles?: boolean

    Whether to retain log files that contain no SQL statements (default: false). When false, empty log files are automatically deleted on dispose

    sessionName?: string

    Optional friendly name for this logging session (for UI display)

    statementTypes?: "queries" | "mutations" | "both"

    Which types of statements to log: 'queries' (all), 'mutations' (only data changes), 'both' (default)

    variableBatchThreshold?: number

    When set, enables variable-count-based batch separation instead of emitting the batch separator after every statement. The logger tracks how many SQL variable declarations (DECLARE @...) have accumulated in the current batch. When the running count reaches this threshold, a batch separator is emitted before the next statement and the counter resets.

    This prevents SQL Server's 10,000-variable-per-batch limit from being hit on large migration files while avoiding the verbosity of one GO per statement.

    Requires batchSeparator to also be set. Recommended value: 200. Set to 0 or leave undefined to use the legacy per-statement behavior.

    verboseOutput?: boolean

    Whether to output verbose debug information to console (default: false)