ConstraintFinderInterface
API reference › yii › db › ConstraintFinderInterface
Implemented by 5 types
ConstraintFinderInterface defines methods for getting a table constraint information.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
getSchemaChecks() abstract | Returns check constraints for all tables in the database. | ConstraintFinderInterface |
getSchemaDefaultValues() abstract | Returns default value constraints for all tables in the database. | ConstraintFinderInterface |
getSchemaForeignKeys() abstract | Returns foreign keys for all tables in the database. | ConstraintFinderInterface |
getSchemaIndexes() abstract | Returns indexes for all tables in the database. | ConstraintFinderInterface |
getSchemaPrimaryKeys() abstract | Returns primary keys for all tables in the database. | ConstraintFinderInterface |
getSchemaUniques() abstract | Returns unique constraints for all tables in the database. | ConstraintFinderInterface |
getTableChecks() abstract | Obtains the check constraints information for the named table. | ConstraintFinderInterface |
getTableDefaultValues() abstract | Obtains the default value constraints information for the named table. | ConstraintFinderInterface |
getTableForeignKeys() abstract | Obtains the foreign keys information for the named table. | ConstraintFinderInterface |
getTableIndexes() abstract | Obtains the indexes information for the named table. | ConstraintFinderInterface |
getTablePrimaryKey() abstract | Obtains the primary key for the named table. | ConstraintFinderInterface |
getTableUniques() abstract | Obtains the unique constraints information for the named table. | ConstraintFinderInterface |
Method details
Section titled “Method details”getSchemaChecks()
Section titled “getSchemaChecks() ”abstract public function getSchemaChecks(string $schema = '', bool $refresh = false): yii\db\CheckConstraint[][]Returns check constraints for all tables in the database.
Parameters
| Parameter | Type | Description |
|---|---|---|
$schema | string | The schema of the tables. Defaults to empty string, meaning the current or default schema name. |
$refresh | bool | Whether to fetch the latest available table schemas. If this is false, cached data may be returned if available. |
Returns
CheckConstraint[][]: Check constraints for all tables in the database. Each array element is an array of CheckConstraint or its child classes.
getSchemaDefaultValues()
Section titled “getSchemaDefaultValues() ”abstract public function getSchemaDefaultValues(string $schema = '', bool $refresh = false): yii\db\DefaultValueConstraint[]Returns default value constraints for all tables in the database.
Parameters
| Parameter | Type | Description |
|---|---|---|
$schema | string | The schema of the tables. Defaults to empty string, meaning the current or default schema name. |
$refresh | bool | Whether to fetch the latest available table schemas. If this is false, cached data may be returned if available. |
Returns
DefaultValueConstraint[]: Default value constraints for all tables in the database. Each array element is an array of DefaultValueConstraint or its child classes.
getSchemaForeignKeys()
Section titled “getSchemaForeignKeys() ”abstract public function getSchemaForeignKeys(string $schema = '', bool $refresh = false): yii\db\ForeignKeyConstraint[][]Returns foreign keys for all tables in the database.
Parameters
| Parameter | Type | Description |
|---|---|---|
$schema | string | The schema of the tables. Defaults to empty string, meaning the current or default schema name. |
$refresh | bool | Whether to fetch the latest available table schemas. If this is false, cached data may be returned if available. |
Returns
ForeignKeyConstraint[][]: Foreign keys for all tables in the database. Each array element is an array of ForeignKeyConstraint or its child classes.
getSchemaIndexes()
Section titled “getSchemaIndexes() ”abstract public function getSchemaIndexes(string $schema = '', bool $refresh = false): yii\db\IndexConstraint[][]Returns indexes for all tables in the database.
Parameters
| Parameter | Type | Description |
|---|---|---|
$schema | string | The schema of the tables. Defaults to empty string, meaning the current or default schema name. |
$refresh | bool | Whether to fetch the latest available table schemas. If this is false, cached data may be returned if available. |
Returns
IndexConstraint[][]: Indexes for all tables in the database. Each array element is an array of IndexConstraint or its child classes.
getSchemaPrimaryKeys()
Section titled “getSchemaPrimaryKeys() ”abstract public function getSchemaPrimaryKeys(string $schema = '', bool $refresh = false): yii\db\Constraint[]Returns primary keys for all tables in the database.
Parameters
| Parameter | Type | Description |
|---|---|---|
$schema | string | The schema of the tables. Defaults to empty string, meaning the current or default schema name. |
$refresh | bool | Whether to fetch the latest available table schemas. If this is false, cached data may be returned if available. |
Returns
Constraint[]: Primary keys for all tables in the database. Each array element is an instance of Constraint or its child class.
getSchemaUniques()
Section titled “getSchemaUniques() ”abstract public function getSchemaUniques(string $schema = '', bool $refresh = false): yii\db\Constraint[][]Returns unique constraints for all tables in the database.
Parameters
| Parameter | Type | Description |
|---|---|---|
$schema | string | The schema of the tables. Defaults to empty string, meaning the current or default schema name. |
$refresh | bool | Whether to fetch the latest available table schemas. If this is false, cached data may be returned if available. |
Returns
Constraint[][]: Unique constraints for all tables in the database. Each array element is an array of Constraint or its child classes.
getTableChecks()
Section titled “getTableChecks() ”abstract public function getTableChecks(string $name, bool $refresh = false): yii\db\CheckConstraint[]Obtains the check constraints information for the named table.
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | Table name. The table name may contain schema name if any. Do not quote the table name. |
$refresh | bool | Whether to reload the information even if it is found in the cache. |
Returns
CheckConstraint[]: Table check constraints.
getTableDefaultValues()
Section titled “getTableDefaultValues() ”abstract public function getTableDefaultValues(string $name, bool $refresh = false): yii\db\DefaultValueConstraint[]Obtains the default value constraints information for the named table.
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | Table name. The table name may contain schema name if any. Do not quote the table name. |
$refresh | bool | Whether to reload the information even if it is found in the cache. |
Returns
DefaultValueConstraint[]: Table default value constraints.
getTableForeignKeys()
Section titled “getTableForeignKeys() ”abstract public function getTableForeignKeys(string $name, bool $refresh = false): yii\db\ForeignKeyConstraint[]Obtains the foreign keys information for the named table.
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | Table name. The table name may contain schema name if any. Do not quote the table name. |
$refresh | bool | Whether to reload the information even if it is found in the cache. |
Returns
ForeignKeyConstraint[]: Table foreign keys.
getTableIndexes()
Section titled “getTableIndexes() ”abstract public function getTableIndexes(string $name, bool $refresh = false): yii\db\IndexConstraint[]Obtains the indexes information for the named table.
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | Table name. The table name may contain schema name if any. Do not quote the table name. |
$refresh | bool | Whether to reload the information even if it is found in the cache. |
Returns
IndexConstraint[]: Table indexes.
getTablePrimaryKey()
Section titled “getTablePrimaryKey() ”abstract public function getTablePrimaryKey(string $name, bool $refresh = false): yii\db\Constraint|nullObtains the primary key for the named table.
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | Table name. The table name may contain schema name if any. Do not quote the table name. |
$refresh | bool | Whether to reload the information even if it is found in the cache. |
Returns
Constraint|null: Table primary key, null if the table has no primary key.
getTableUniques()
Section titled “getTableUniques() ”abstract public function getTableUniques(string $name, bool $refresh = false): yii\db\Constraint[]Obtains the unique constraints information for the named table.
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | Table name. The table name may contain schema name if any. Do not quote the table name. |
$refresh | bool | Whether to reload the information even if it is found in the cache. |
Returns
Constraint[]: Table unique constraints.