0 follower

Final Class Yiisoft\Db\Constraint\Check

InheritanceYiisoft\Db\Constraint\Check

Represents a CHECK constraint in a database.

A CHECK constraint is a constraint that allows you to specify a condition that must be met for the data to be inserted or updated.

The constraint checks that the value of a specified column or expression meets a certain condition, if the condition isn't met, an error will be thrown, and the data won't be inserted or updated.

Public Methods

Hide inherited methods

Method Description Defined By
__construct() Yiisoft\Db\Constraint\Check

Property Details

Hide inherited properties

$columnNames public property
public array $columnNames = []
$expression public property
public string $expression ''
$name public property
public string $name ''

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( string $name '', string[] $columnNames = [], string $expression '' )
$name string

The constraint name.

$columnNames string[]

The list of column names the constraint belongs to.

$expression string

The SQL of the CHECK constraint.

                public function __construct(
    public readonly string $name = '',
    public readonly array $columnNames = [],
    public readonly string $expression = '',
) {}