0 follower

Final Class Yiisoft\Db\Constraint\Index

InheritanceYiisoft\Db\Constraint\Index

Represents an index constraint in a database.

An index constraint is a constraint that enforces uniqueness or non-uniqueness of a column or a set of columns.

It has information about the table and column(s) that the constraint applies to, as well as whether the index is unique.

Public Methods

Hide inherited methods

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

Property Details

Hide inherited properties

$columnNames public property
public array $columnNames = []
$isPrimaryKey public property
public boolean $isPrimaryKey false
$isUnique public property
public boolean $isUnique false
$name public property
public string $name ''

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( string $name '', string[] $columnNames = [], boolean $isUnique false, boolean $isPrimaryKey false )
$name string

The constraint name.

$columnNames string[]

The list of column names the constraint belongs to.

$isUnique boolean

Whether the index is unique.

$isPrimaryKey boolean

Whether the index was created for a primary key.

                public function __construct(
    public readonly string $name = '',
    public readonly array $columnNames = [],
    public readonly bool $isUnique = false,
    public readonly bool $isPrimaryKey = false,
) {}