PHP Class yii\db\pgsql\Schema

Since: 2.0
Author: Gevik Babakhani ([email protected])
Inheritance: extends yii\db\Schema
Show file Open project: yiisoft/yii2

Public Properties

Property Type Description
$defaultSchema the default schema used for the current session.
$typeMap mapping from physical column types (keys) to abstract column types (values)

Public Methods

Method Description
createQueryBuilder ( ) : QueryBuilder Creates a query builder for the PostgreSQL database.
findUniqueIndexes ( yii\db\TableSchema $table ) : array Returns all unique indexes for the given table.
getViewNames ( string $schema = '', boolean $refresh = false ) : string[] Returns all view names in the database.
insert ( $table, $columns )
loadTableSchema ( string $name ) : yii\db\TableSchema | null Loads the metadata for the specified table.
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.
findSchemaNames ( ) : array Returns all schema names in the database, including the default one but not system schemas.
findTableNames ( string $schema = '' ) : array Returns all table names in the database.
findViewNames ( string $schema = '' ) : array Returns all views names in the database.
getUniqueIndexInformation ( yii\db\TableSchema $table ) : array Gets information about given table unique indexes.
loadColumnSchema ( array $info ) : ColumnSchema Loads the column information into a [[ColumnSchema]] object.
resolveTableNames ( yii\db\TableSchema $table, string $name ) Resolves the table name and schema name (if any).

Method Details

createQueryBuilder() public method

Creates a query builder for the PostgreSQL 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

findSchemaNames() protected method

This method should be overridden by child classes in order to support this feature because the default implementation simply throws an exception.
Since: 2.0.4
protected findSchemaNames ( ) : array
return array all schema names in the database, except system schemas

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.

findViewNames() protected method

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

getUniqueIndexInformation() protected method

Gets information about given table unique indexes.
protected getUniqueIndexInformation ( yii\db\TableSchema $table ) : array
$table yii\db\TableSchema the table metadata
return array with index and column names

getViewNames() public method

Returns all view names in the database.
Since: 2.0.9
public getViewNames ( string $schema = '', boolean $refresh = false ) : string[]
$schema string the schema of the views. Defaults to empty string, meaning the current or default schema name. If not empty, the returned view names will be prefixed with the schema name.
$refresh boolean whether to fetch the latest available view names. If this is false, view names fetched previously (if available) will be returned.
return string[] all view names in the database.

insert() public method

public insert ( $table, $columns )

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() public method

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

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

$defaultSchema public property

the default schema used for the current session.
public $defaultSchema

$typeMap public property

mapping from physical column types (keys) to abstract column types (values)
See also: http://www.postgresql.org/docs/current/static/datatype.html#DATATYPE-TABLE
public $typeMap