Interface Yiisoft\Db\Constraint\ConstraintSchemaInterface
| Implemented by | Yiisoft\Db\Schema\SchemaInterface |
|---|
Defines the methods to get information about database constraints:
- Name of the constraint
- Columns that the constraint applies to
- Type of constraint
A constraint is a rule that's applied to enforce the integrity and correctness of the data.
Public Methods
Method Details
Returns check constraints for all tables in the database.
| public abstract Yiisoft\Db\Constraint\Check[] getSchemaChecks ( string $schema = '', boolean $refresh = false ) | ||
| $schema | string |
The schema of the tables. Defaults to empty string, meaning the current or default schema name. |
| $refresh | boolean |
Whether to fetch the latest available table schemas. If this is |
| return | Yiisoft\Db\Constraint\Check[] |
The check constraints for all tables in the database. |
|---|---|---|
public function getSchemaChecks(string $schema = '', bool $refresh = false): array;
Returns default value constraints for all tables in the database.
| public abstract Yiisoft\Db\Constraint\DefaultValue[] getSchemaDefaultValues ( string $schema = '', boolean $refresh = false ) | ||
| $schema | string |
The schema of the tables. Defaults to empty string, meaning the current or default schema name. |
| $refresh | boolean |
Whether to fetch the latest available table schemas. If this is |
| return | Yiisoft\Db\Constraint\DefaultValue[] |
The default value constraints for all tables in the database. |
|---|---|---|
public function getSchemaDefaultValues(string $schema = '', bool $refresh = false): array;
Returns foreign keys for all tables in the database.
| public abstract Yiisoft\Db\Constraint\ForeignKey[] getSchemaForeignKeys ( string $schema = '', boolean $refresh = false ) | ||
| $schema | string |
The schema of the tables. Defaults to empty string, meaning the current or default schema name. |
| $refresh | boolean |
Whether to fetch the latest available table schemas. If this is |
| return | Yiisoft\Db\Constraint\ForeignKey[] |
The foreign keys for all tables in the database. |
|---|---|---|
public function getSchemaForeignKeys(string $schema = '', bool $refresh = false): array;
Returns indexes for all tables in the database.
| public abstract Yiisoft\Db\Constraint\Index[] getSchemaIndexes ( string $schema = '', boolean $refresh = false ) | ||
| $schema | string |
The schema of the tables. Defaults to empty string, meaning the current or default schema name. |
| $refresh | boolean |
Whether to fetch the latest available table schemas. If this is false, cached data may be returned if available. |
| return | Yiisoft\Db\Constraint\Index[] |
The indexes for all tables in the database. |
|---|---|---|
public function getSchemaIndexes(string $schema = '', bool $refresh = false): array;
Returns primary keys for all tables in the database.
| public abstract Yiisoft\Db\Constraint\Index[] getSchemaPrimaryKeys ( string $schema = '', boolean $refresh = false ) | ||
| $schema | string |
The schema of the tables. Defaults to empty string, meaning the current or default schema name. |
| $refresh | boolean |
Whether to fetch the latest available table schemas. If this is |
| return | Yiisoft\Db\Constraint\Index[] |
The primary keys for all tables in the database. |
|---|---|---|
public function getSchemaPrimaryKeys(string $schema = '', bool $refresh = false): array;
Returns unique constraints for all tables in the database.
| public abstract Yiisoft\Db\Constraint\Index[] getSchemaUniques ( string $schema = '', boolean $refresh = false ) | ||
| $schema | string |
The schema of the tables. Defaults to empty string, meaning the current or default schema name. |
| $refresh | boolean |
Whether to fetch the latest available table schemas. If this is |
| return | Yiisoft\Db\Constraint\Index[] |
The unique constraints for all tables in the database. |
|---|---|---|
public function getSchemaUniques(string $schema = '', bool $refresh = false): array;
Obtains the check constraints' information for the named table.
| public abstract Yiisoft\Db\Constraint\Check[] getTableChecks ( string $name, boolean $refresh = false ) | ||
| $name | string |
Table name. The table name may contain a schema name if any. Don't quote the table name. |
| $refresh | boolean |
Whether to reload the information, even if it's found in the cache. |
| return | Yiisoft\Db\Constraint\Check[] |
The information metadata for the check constraints of the named table. |
|---|---|---|
public function getTableChecks(string $name, bool $refresh = false): array;
Obtains the default value constraints information for the named table.
| public abstract Yiisoft\Db\Constraint\DefaultValue[] getTableDefaultValues ( string $name, boolean $refresh = false ) | ||
| $name | string |
Table name. The table name may contain a schema name if any. Don't quote the table name. |
| $refresh | boolean |
Whether to reload the information, even if it's found in the cache. |
| return | Yiisoft\Db\Constraint\DefaultValue[] |
The information metadata for the default value constraints of the named table. |
|---|---|---|
public function getTableDefaultValues(string $name, bool $refresh = false): array;
Obtains the foreign keys' information for the named table.
| public abstract Yiisoft\Db\Constraint\ForeignKey[] getTableForeignKeys ( string $name, boolean $refresh = false ) | ||
| $name | string |
Table name. The table name may contain a schema name if any. Don't quote the table name. |
| $refresh | boolean |
Whether to reload the information, even if it's found in the cache. |
| return | Yiisoft\Db\Constraint\ForeignKey[] |
The information metadata for the foreign keys of the named table. |
|---|---|---|
public function getTableForeignKeys(string $name, bool $refresh = false): array;
Obtains the indexes' information for the named table.
| public abstract Yiisoft\Db\Constraint\Index[] getTableIndexes ( string $name, boolean $refresh = false ) | ||
| $name | string |
Table name. The table name may contain a schema name if any. Don't quote the table name. |
| $refresh | boolean |
Whether to reload the information, even if it's found in the cache. |
| return | Yiisoft\Db\Constraint\Index[] |
The information metadata for the indexes of the named table. |
|---|---|---|
public function getTableIndexes(string $name, bool $refresh = false): array;
Obtains the primary key for the named table.
| public abstract Yiisoft\Db\Constraint\Index|null getTablePrimaryKey ( string $name, boolean $refresh = false ) | ||
| $name | string |
Table name. The table name may contain a schema name if any. Don't quote the table name. |
| $refresh | boolean |
Whether to reload the information, even if it's found in the cache. |
| return | Yiisoft\Db\Constraint\Index|null |
The information metadata for the primary key of the named table. |
|---|---|---|
public function getTablePrimaryKey(string $name, bool $refresh = false): ?Index;
Obtains the unique constraints' information for the named table.
| public abstract Yiisoft\Db\Constraint\Index[] getTableUniques ( string $name, boolean $refresh = false ) | ||
| $name | string |
Table name. The table name may contain a schema name if any. Don't quote the table name. |
| $refresh | boolean |
Whether to reload the information, even if it's found in the cache. |
| return | Yiisoft\Db\Constraint\Index[] |
The information metadata for the unique constraints of the named table. |
|---|---|---|
public function getTableUniques(string $name, bool $refresh = false): array;
Signup or Login in order to comment.