PHP Class Cake\Database\Schema\SqliteSchema

Inheritance: extends Cake\Database\Schema\BaseSchema
Show file Open project: cakephp/cakephp Class Usage Examples

Protected Properties

Property Type Description
$_constraintsIdMap array Array containing the foreign keys constraints names Necessary for composite foreign keys to be handled

Public Methods

Method Description
addConstraintSql ( Table $table ) {@inheritDoc}
columnSql ( Table $table, $name ) {@inheritDoc}
constraintSql ( Table $table, $name ) {@inheritDoc}
convertColumnDescription ( Table $table, $row ) {@inheritDoc}
convertForeignKeyDescription ( Table $table, $row ) {@inheritDoc}
convertIndexDescription ( Table $table, $row ) {@inheritDoc}
createTableSql ( Table $table, $columns, $constraints, $indexes ) {@inheritDoc}
describeColumnSql ( $tableName, $config ) {@inheritDoc}
describeForeignKeySql ( $tableName, $config ) {@inheritDoc}
describeIndexSql ( $tableName, $config ) {@inheritDoc}
dropConstraintSql ( Table $table ) {@inheritDoc}
hasSequences ( ) : boolean Returns whether there is any table in this connection to SQLite containing sequences
indexSql ( Table $table, $name ) {@inheritDoc}
listTablesSql ( $config ) {@inheritDoc}
truncateTableSql ( Table $table ) {@inheritDoc}

Protected Methods

Method Description
_convertColumn ( string $column ) : array Convert a column definition to the abstract types.
_defaultValue ( string | null $default ) : string | null Manipulate the default value.

Method Details

_convertColumn() protected method

The returned type will be a type that Cake\Database\Type can handle.
protected _convertColumn ( string $column ) : array
$column string The column type + length
return array Array of column information.

_defaultValue() protected method

Sqlite includes quotes and bared NULLs in default values. We need to remove those.
protected _defaultValue ( string | null $default ) : string | null
$default string | null The default value.
return string | null

addConstraintSql() public method

SQLite can not properly handle adding a constraint to an existing table. This method is no-op
public addConstraintSql ( Table $table )
$table Table

columnSql() public method

{@inheritDoc}
public columnSql ( Table $table, $name )
$table Table

constraintSql() public method

Note integer primary keys will return ''. This is intentional as Sqlite requires that integer primary keys be defined in the column definition.
public constraintSql ( Table $table, $name )
$table Table

convertColumnDescription() public method

{@inheritDoc}
public convertColumnDescription ( Table $table, $row )
$table Table

convertForeignKeyDescription() public method

{@inheritDoc}
public convertForeignKeyDescription ( Table $table, $row )
$table Table

convertIndexDescription() public method

Since SQLite does not have a way to get metadata about all indexes at once, additional queries are done here. Sqlite constraint names are not stable, and the names for constraints will not match those used to create the table. This is a limitation in Sqlite's metadata features.
public convertIndexDescription ( Table $table, $row )
$table Table

createTableSql() public method

{@inheritDoc}
public createTableSql ( Table $table, $columns, $constraints, $indexes )
$table Table

describeColumnSql() public method

{@inheritDoc}
public describeColumnSql ( $tableName, $config )

describeForeignKeySql() public method

{@inheritDoc}
public describeForeignKeySql ( $tableName, $config )

describeIndexSql() public method

{@inheritDoc}
public describeIndexSql ( $tableName, $config )

dropConstraintSql() public method

SQLite can not properly handle dropping a constraint to an existing table. This method is no-op
public dropConstraintSql ( Table $table )
$table Table

hasSequences() public method

Returns whether there is any table in this connection to SQLite containing sequences
public hasSequences ( ) : boolean
return boolean

indexSql() public method

{@inheritDoc}
public indexSql ( Table $table, $name )
$table Table

listTablesSql() public method

{@inheritDoc}
public listTablesSql ( $config )

truncateTableSql() public method

{@inheritDoc}
public truncateTableSql ( Table $table )
$table Table

Property Details

$_constraintsIdMap protected property

Array containing the foreign keys constraints names Necessary for composite foreign keys to be handled
protected array $_constraintsIdMap
return array