prorm API Reference
    Preparing search index...

    Interface CreatePolicyOptions

    A row-level security policy: who it applies to, which command, and the expressions that decide visibility (using) and writability (withCheck).

    interface CreatePolicyOptions {
        table: string;
        name: string;
        using?: string | WhereOptions;
        withCheck?: string | WhereOptions;
        for?: "SELECT" | "INSERT" | "UPDATE" | "DELETE" | "ALL";
        to?: string[];
    }
    Index
    table: string

    Table the policy applies to

    name: string

    Policy name

    using?: string | WhereOptions

    Rows visible to the command, as a where object — the same syntax a query takes, compiled for the target dialect:

    { using: { tenantId: { $eq: literalExpr('current_setting(\'app.tenant\')') } } }
    

    A raw SQL string is still accepted but deprecated.

    withCheck?: string | WhereOptions

    Rows the command may write, as a where object. A raw SQL string is still accepted but deprecated.

    for?: "SELECT" | "INSERT" | "UPDATE" | "DELETE" | "ALL"

    Command the policy applies to

    to?: string[]

    Roles the policy applies to