0 follower

Interface Yiisoft\Db\Constraint\ConstraintSchemaInterface

Implemented byYiisoft\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

Hide inherited methods

Method Description Defined By
getSchemaChecks() Returns check constraints for all tables in the database. Yiisoft\Db\Constraint\ConstraintSchemaInterface
getSchemaDefaultValues() Returns default value constraints for all tables in the database. Yiisoft\Db\Constraint\ConstraintSchemaInterface
getSchemaForeignKeys() Returns foreign keys for all tables in the database. Yiisoft\Db\Constraint\ConstraintSchemaInterface
getSchemaIndexes() Returns indexes for all tables in the database. Yiisoft\Db\Constraint\ConstraintSchemaInterface
getSchemaPrimaryKeys() Returns primary keys for all tables in the database. Yiisoft\Db\Constraint\ConstraintSchemaInterface
getSchemaUniques() Returns unique constraints for all tables in the database. Yiisoft\Db\Constraint\ConstraintSchemaInterface
getTableChecks() Obtains the check constraints' information for the named table. Yiisoft\Db\Constraint\ConstraintSchemaInterface
getTableDefaultValues() Obtains the default value constraints information for the named table. Yiisoft\Db\Constraint\ConstraintSchemaInterface
getTableForeignKeys() Obtains the foreign keys' information for the named table. Yiisoft\Db\Constraint\ConstraintSchemaInterface
getTableIndexes() Obtains the indexes' information for the named table. Yiisoft\Db\Constraint\ConstraintSchemaInterface
getTablePrimaryKey() Obtains the primary key for the named table. Yiisoft\Db\Constraint\ConstraintSchemaInterface
getTableUniques() Obtains the unique constraints' information for the named table. Yiisoft\Db\Constraint\ConstraintSchemaInterface

Method Details

Hide inherited methods

getSchemaChecks() public abstract method

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 false, cached data may be returned if available.

return Yiisoft\Db\Constraint\Check[]

The check constraints for all tables in the database.

                public function getSchemaChecks(string $schema = '', bool $refresh = false): array;

            
getSchemaDefaultValues() public abstract method

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 false, cached data may be returned if available.

return Yiisoft\Db\Constraint\DefaultValue[]

The default value constraints for all tables in the database.

                public function getSchemaDefaultValues(string $schema = '', bool $refresh = false): array;

            
getSchemaForeignKeys() public abstract method

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 false, cached data may be returned if available.

return Yiisoft\Db\Constraint\ForeignKey[]

The foreign keys for all tables in the database.

                public function getSchemaForeignKeys(string $schema = '', bool $refresh = false): array;

            
getSchemaIndexes() public abstract method

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;

            
getSchemaPrimaryKeys() public abstract method

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 false, cached data may be returned if available.

return Yiisoft\Db\Constraint\Index[]

The primary keys for all tables in the database.

                public function getSchemaPrimaryKeys(string $schema = '', bool $refresh = false): array;

            
getSchemaUniques() public abstract method

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 false, cached data may be returned if available.

return Yiisoft\Db\Constraint\Index[]

The unique constraints for all tables in the database.

                public function getSchemaUniques(string $schema = '', bool $refresh = false): array;

            
getTableChecks() public abstract method

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;

            
getTableDefaultValues() public abstract method

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;

            
getTableForeignKeys() public abstract method

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;

            
getTableIndexes() public abstract method

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;

            
getTablePrimaryKey() public abstract method

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;

            
getTableUniques() public abstract method

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;