0 follower

Interface Yiisoft\Db\Schema\TableSchemaInterface

Implemented byYiisoft\Db\Schema\TableSchema

Represents the metadata of a database table.

It defines a set of methods to retrieve the table name, schema name, column names, primary key, foreign keys, etc.

The information is obtained from the database schema and may vary according to the DBMS type.

Public Methods

Hide inherited methods

Method Description Defined By
checks() Set check constraints of this table. Yiisoft\Db\Schema\TableSchemaInterface
column() Set metadata for a column specified. Yiisoft\Db\Schema\TableSchemaInterface
columns() Set metadata for multiple columns. Yiisoft\Db\Schema\TableSchemaInterface
comment() Set the comment of the table or null if there is no comment. Yiisoft\Db\Schema\TableSchemaInterface
createSql() Set SQL for creating this table, empty string if it is not found, or null if it is not initialized. Yiisoft\Db\Schema\TableSchemaInterface
defaultValues() Set default value constraints of this table. Yiisoft\Db\Schema\TableSchemaInterface
foreignKeys() Set foreign key constraints of this table. Yiisoft\Db\Schema\TableSchemaInterface
getChecks() Yiisoft\Db\Schema\TableSchemaInterface
getColumn() Returns the named column metadata or null if the named column does not exist. Yiisoft\Db\Schema\TableSchemaInterface
getColumnNames() Yiisoft\Db\Schema\TableSchemaInterface
getColumns() Yiisoft\Db\Schema\TableSchemaInterface
getComment() Returns the comment of the table or null if no comment. Yiisoft\Db\Schema\TableSchemaInterface
getCreateSql() Returns SQL for create this table, empty string if it is not found, or null if it is not initialized. Yiisoft\Db\Schema\TableSchemaInterface
getDefaultValues() Yiisoft\Db\Schema\TableSchemaInterface
getForeignKeys() Yiisoft\Db\Schema\TableSchemaInterface
getFullName() Returns the full name of this table including the schema name. Yiisoft\Db\Schema\TableSchemaInterface
getIndexes() Returns the index constraints of this table. Yiisoft\Db\Schema\TableSchemaInterface
getName() Returns the table name. The schema name is not included. Use {@see getFullName()} to get the table name with the schema name. Yiisoft\Db\Schema\TableSchemaInterface
getOptions() Returns the options of this table. Yiisoft\Db\Schema\TableSchemaInterface
getPrimaryKey() Yiisoft\Db\Schema\TableSchemaInterface
getSchemaName() Returns the schema name that this table belongs to. Yiisoft\Db\Schema\TableSchemaInterface
getSequenceName() Return the sequence name for the primary key or null if no sequence. Yiisoft\Db\Schema\TableSchemaInterface
getUniques() Returns the unique indexes of this table. Yiisoft\Db\Schema\TableSchemaInterface
indexes() Set indexes of this table. Yiisoft\Db\Schema\TableSchemaInterface
name() Set the name of this table. Yiisoft\Db\Schema\TableSchemaInterface
options() Set the options of this table. Yiisoft\Db\Schema\TableSchemaInterface
schemaName() Set the name of the schema that this table belongs to or empty string for the default schema. Yiisoft\Db\Schema\TableSchemaInterface
sequenceName() Set a sequence name for the primary key or null if no sequence. Yiisoft\Db\Schema\TableSchemaInterface

Method Details

Hide inherited methods

checks() public abstract method

Set check constraints of this table.

public abstract Yiisoft\Db\Schema\TableSchemaInterface checks ( Yiisoft\Db\Constraint\Check $checks )
$checks Yiisoft\Db\Constraint\Check

The check constraints.

                public function checks(Check ...$checks): static;

            
column() public abstract method

Set metadata for a column specified.

public abstract Yiisoft\Db\Schema\TableSchemaInterface column ( string $name, Yiisoft\Db\Schema\Column\ColumnInterface $column )
$name string

The column name.

$column Yiisoft\Db\Schema\Column\ColumnInterface

                public function column(string $name, ColumnInterface $column): static;

            
columns() public abstract method

Set metadata for multiple columns.

public abstract Yiisoft\Db\Schema\TableSchemaInterface columns ( Yiisoft\Db\Schema\Column\ColumnInterface[] $columns )
$columns Yiisoft\Db\Schema\Column\ColumnInterface[]

The columns metadata indexed by column names.

                public function columns(array $columns): static;

            
comment() public abstract method

Set the comment of the table or null if there is no comment.

Not all DBMS support this.

public abstract Yiisoft\Db\Schema\TableSchemaInterface comment ( string|null $comment )
$comment string|null

                public function comment(?string $comment): static;

            
createSql() public abstract method

Set SQL for creating this table, empty string if it is not found, or null if it is not initialized.

Supported by MySQL and Oracle DBMS.

public abstract Yiisoft\Db\Schema\TableSchemaInterface createSql ( string|null $sql )
$sql string|null

                public function createSql(?string $sql): static;

            
defaultValues() public abstract method

Set default value constraints of this table.

public abstract Yiisoft\Db\Schema\TableSchemaInterface defaultValues ( Yiisoft\Db\Constraint\DefaultValue $defaultValues )
$defaultValues Yiisoft\Db\Constraint\DefaultValue

The default value constraints.

                public function defaultValues(DefaultValue ...$defaultValues): static;

            
foreignKeys() public abstract method

Set foreign key constraints of this table.

public abstract Yiisoft\Db\Schema\TableSchemaInterface foreignKeys ( Yiisoft\Db\Constraint\ForeignKey $foreignKeys )
$foreignKeys Yiisoft\Db\Constraint\ForeignKey

The foreign key constraints.

                public function foreignKeys(ForeignKey ...$foreignKeys): static;

            
getChecks() public abstract method

public abstract Yiisoft\Db\Constraint\Check[] getChecks ( )
return Yiisoft\Db\Constraint\Check[]

The check constraints of this table.

                public function getChecks(): array;

            
getColumn() public abstract method

Returns the named column metadata or null if the named column does not exist.

public abstract Yiisoft\Db\Schema\Column\ColumnInterface|null getColumn ( string $name )
$name string

The column name.

                public function getColumn(string $name): ?ColumnInterface;

            
getColumnNames() public abstract method

public abstract string[] getColumnNames ( )
return string[]

The names of all columns in this table.

                public function getColumnNames(): array;

            
getColumns() public abstract method

public abstract Yiisoft\Db\Schema\Column\ColumnInterface[] getColumns ( )
return Yiisoft\Db\Schema\Column\ColumnInterface[]

The column metadata of this table. Array of {@see \Yiisoft\Db\Schema\Column\ColumnInterface} objects indexed by column names.

                public function getColumns(): array;

            
getComment() public abstract method

Returns the comment of the table or null if no comment.

public abstract string|null getComment ( )

                public function getComment(): ?string;

            
getCreateSql() public abstract method

Returns SQL for create this table, empty string if it is not found, or null if it is not initialized.

Supported by MySQL and Oracle DBMS.

public abstract string|null getCreateSql ( )

                public function getCreateSql(): ?string;

            
getDefaultValues() public abstract method

public abstract Yiisoft\Db\Constraint\DefaultValue[] getDefaultValues ( )
return Yiisoft\Db\Constraint\DefaultValue[]

The default value constraints of this table.

                public function getDefaultValues(): array;

            
getForeignKeys() public abstract method

public abstract Yiisoft\Db\Constraint\ForeignKey[] getForeignKeys ( )
return Yiisoft\Db\Constraint\ForeignKey[]

The foreign key constraints of this table.

                public function getForeignKeys(): array;

            
getFullName() public abstract method

Returns the full name of this table including the schema name.

public abstract string getFullName ( )

                public function getFullName(): string;

            
getIndexes() public abstract method

Returns the index constraints of this table.

public abstract Yiisoft\Db\Constraint\Index[] getIndexes ( )
return Yiisoft\Db\Constraint\Index[]

The index constraints of this table.

                public function getIndexes(): array;

            
getName() public abstract method

Returns the table name. The schema name is not included. Use {@see getFullName()} to get the table name with the schema name.

public abstract string getName ( )

                public function getName(): string;

            
getOptions() public abstract method

Returns the options of this table.

public abstract string[] getOptions ( )
return string[]

The options of this table.

                public function getOptions(): array;

            
getPrimaryKey() public abstract method

public abstract string[] getPrimaryKey ( )
return string[]

The primary key column names.

                public function getPrimaryKey(): array;

            
getSchemaName() public abstract method

Returns the schema name that this table belongs to.

public abstract string getSchemaName ( )

                public function getSchemaName(): string;

            
getSequenceName() public abstract method

Return the sequence name for the primary key or null if no sequence.

public abstract string|null getSequenceName ( )

                public function getSequenceName(): ?string;

            
getUniques() public abstract method

Returns the unique indexes of this table.

public abstract Yiisoft\Db\Constraint\Index[] getUniques ( )
return Yiisoft\Db\Constraint\Index[]

The unique indexes of this table.

                public function getUniques(): array;

            
indexes() public abstract method

Set indexes of this table.

public abstract Yiisoft\Db\Schema\TableSchemaInterface indexes ( Yiisoft\Db\Constraint\Index $indexes )
$indexes Yiisoft\Db\Constraint\Index

The indexes.

                public function indexes(Index ...$indexes): static;

            
name() public abstract method

Set the name of this table.

The schema name must not be included. Use {@see \Yiisoft\Db\Schema\schemaName()} to set the table schema name.

public abstract Yiisoft\Db\Schema\TableSchemaInterface name ( string $name )
$name string

                public function name(string $name): static;

            
options() public abstract method

Set the options of this table.

public abstract Yiisoft\Db\Schema\TableSchemaInterface options ( string $options )
$options string

The options.

                public function options(string ...$options): static;

            
schemaName() public abstract method

Set the name of the schema that this table belongs to or empty string for the default schema.

public abstract Yiisoft\Db\Schema\TableSchemaInterface schemaName ( string $schemaName )
$schemaName string

                public function schemaName(string $schemaName): static;

            
sequenceName() public abstract method

Set a sequence name for the primary key or null if no sequence.

public abstract Yiisoft\Db\Schema\TableSchemaInterface sequenceName ( string|null $sequenceName )
$sequenceName string|null

                public function sequenceName(?string $sequenceName): static;