PHP Class yii\db\mysql\Schema

Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends yii\db\Schema
Show file Open project: yiisoft/yii2 Class Usage Examples

Public Properties

Property Type Description
$typeMap mapping from physical column types (keys) to abstract column types (values)

Public Methods

Method Description
createColumnSchemaBuilder ( $type, $length = null )
createQueryBuilder ( ) : QueryBuilder Creates a query builder for the MySQL database.
findUniqueIndexes ( yii\db\TableSchema $table ) : array Returns all unique indexes for the given table.
quoteSimpleColumnName ( string $name ) : string Quotes a column name for use in a query.
quoteSimpleTableName ( string $name ) : string Quotes a table name for use in a query.

Protected Methods

Method Description
findColumns ( yii\db\TableSchema $table ) : boolean Collects the metadata of table columns.
findConstraints ( yii\db\TableSchema $table ) Collects the foreign key column details for the given table.
findTableNames ( string $schema = '' ) : array Returns all table names in the database.
getCreateTableSql ( yii\db\TableSchema $table ) : string Gets the CREATE TABLE sql string.
loadColumnSchema ( array $info ) : ColumnSchema Loads the column information into a [[ColumnSchema]] object.
loadTableSchema ( string $name ) : yii\db\TableSchema Loads the metadata for the specified table.
resolveTableNames ( yii\db\TableSchema $table, string $name ) Resolves the table name and schema name (if any).

Method Details

createColumnSchemaBuilder() public method

public createColumnSchemaBuilder ( $type, $length = null )

createQueryBuilder() public method

Creates a query builder for the MySQL database.
public createQueryBuilder ( ) : QueryBuilder
return QueryBuilder query builder instance

findColumns() protected method

Collects the metadata of table columns.
protected findColumns ( yii\db\TableSchema $table ) : boolean
$table yii\db\TableSchema the table metadata
return boolean whether the table exists in the database

findConstraints() protected method

Collects the foreign key column details for the given table.
protected findConstraints ( yii\db\TableSchema $table )
$table yii\db\TableSchema the table metadata

findTableNames() protected method

Returns all table names in the database.
protected findTableNames ( string $schema = '' ) : array
$schema string the schema of the tables. Defaults to empty string, meaning the current or default schema.
return array all table names in the database. The names have NO schema name prefix.

findUniqueIndexes() public method

Each array element is of the following structure: php [ 'IndexName1' => ['col1' [, ...]], 'IndexName2' => ['col2' [, ...]], ]
public findUniqueIndexes ( yii\db\TableSchema $table ) : array
$table yii\db\TableSchema the table metadata
return array all unique indexes for the given table.

getCreateTableSql() protected method

Gets the CREATE TABLE sql string.
protected getCreateTableSql ( yii\db\TableSchema $table ) : string
$table yii\db\TableSchema the table metadata
return string $sql the result of 'SHOW CREATE TABLE'

loadColumnSchema() protected method

Loads the column information into a [[ColumnSchema]] object.
protected loadColumnSchema ( array $info ) : ColumnSchema
$info array column information
return yii\db\ColumnSchema the column schema object

loadTableSchema() protected method

Loads the metadata for the specified table.
protected loadTableSchema ( string $name ) : yii\db\TableSchema
$name string table name
return yii\db\TableSchema driver dependent table metadata. Null if the table does not exist.

quoteSimpleColumnName() public method

A simple column name has no prefix.
public quoteSimpleColumnName ( string $name ) : string
$name string column name
return string the properly quoted column name

quoteSimpleTableName() public method

A simple table name has no schema prefix.
public quoteSimpleTableName ( string $name ) : string
$name string table name
return string the properly quoted table name

resolveTableNames() protected method

Resolves the table name and schema name (if any).
protected resolveTableNames ( yii\db\TableSchema $table, string $name )
$table yii\db\TableSchema the table metadata object
$name string the table name

Property Details

$typeMap public property

mapping from physical column types (keys) to abstract column types (values)
public $typeMap