prorm API Reference
    Preparing search index...

    Interface ConstraintDefinition

    Constraint definition for addConstraint

    interface ConstraintDefinition {
        type: "UNIQUE" | "PRIMARY KEY" | "FOREIGN KEY" | "CHECK";
        fields?: string[];
        name?: string;
        references?: { table: string; fields: string[] };
        onDelete?: string;
        onUpdate?: string;
        check?: string | WhereOptions;
        where?: string | WhereOptions;
    }
    Index
    type: "UNIQUE" | "PRIMARY KEY" | "FOREIGN KEY" | "CHECK"
    fields?: string[]
    name?: string
    references?: { table: string; fields: string[] }
    onDelete?: string
    onUpdate?: string
    check?: string | WhereOptions

    Predicate for a CHECK constraint, as a where object compiled for the target dialect — or a raw SQL string:

    { type: 'CHECK', check: { age: { $gte: 18 } } }   // CHECK ("age" >= 18)
    
    where?: string | WhereOptions

    Partial-index predicate; see IndexOptions.where in src/dialects/dialect.ts. Also accepted as the older spelling of a CHECK constraint's predicate.