prorm API Reference
    Preparing search index...

    Interface MaterializedViewDecoratorOptions

    interface MaterializedViewDecoratorOptions {
        name?: string;
        definition?: ViewDefinition;
        query?: string;
        queryFn?: () => string;
        schema?: string;
        replace?: boolean;
        ifNotExists?: boolean;
        withData?: boolean;
        uniqueIndex?: string;
        refreshStrategy?: RefreshStrategy;
        comment?: string;
    }
    Index
    name?: string

    The materialized view name in the database. Defaults to the class name (snake_cased) if not provided.

    definition?: ViewDefinition

    What the materialized view selects, as query options rather than SQL. Preferred over query; see ViewOptions.definition.

    query?: string

    The SELECT statement that defines the materialized view.

    Prefer definition. One of definition, query or queryFn must be provided.

    queryFn?: () => string

    A function that returns the SELECT statement. Useful when the query depends on runtime values or other model table names.

    Prefer definition.

    schema?: string

    Optional schema prefix (e.g. 'public' for PostgreSQL).

    replace?: boolean

    If true, uses CREATE OR REPLACE MATERIALIZED VIEW. Default: false.

    ifNotExists?: boolean

    If true, uses CREATE MATERIALIZED VIEW IF NOT EXISTS. Default: false.

    withData?: boolean

    If false, uses WITH NO DATA (creates view without populating data). Default: true.

    uniqueIndex?: string

    Unique index name for CONCURRENTLY refresh support. If provided, a unique index will be created on the specified column(s).

    refreshStrategy?: RefreshStrategy

    Refresh strategy for the materialized view.

    • ON DEMAND: Manual refresh using REFRESH MATERIALIZED VIEW (default)
    • ON COMMIT: Auto-refresh on commit (PostgreSQL feature, limited support)
    comment?: string

    Optional comment for the materialized view.