MySQLPlatform extends MySQLPlatform uses GetColumnDeclarationSQLCommentTypeAwareTrait, MySQLCompatibleAlterTablePlatformAwareTrait, MySQLDefaultValueDeclarationSQLOverrideTrait
doctrine/dbal 4+ removed the old doctrine event system. The new way is to extend the platform class(es) and directly override the methods instead of consuming events. Therefore, we need to extend the platform classes to provide some changes for TYPO3 database schema operations.
Normally, this platform should not be used anymore since TYPO3 v12 due to the minimal MySQL requirement of 8.0. However, keep this at least as a default during migration phases.
not part of Public Core API.
Table of Contents
Methods
- getAlterTableSQL() : array<int, string>
- Gets the SQL statements for altering an existing table.
- getColumnDeclarationSQL() : string
- Note that this provides a method override to combine type based comments with the column comment on platforms.
- getDefaultValueDeclarationSQL() : string
- Obtains DBMS specific SQL code portion needed to set a default value declaration to be used in statements like CREATE TABLE.
- getCustomAlterTableSQLEngineOptions() : array<int, string>
Methods
getAlterTableSQL()
Gets the SQL statements for altering an existing table.
public
getAlterTableSQL(TableDiff|TableDiff $diff) : array<int, string>
This method returns an array of SQL statements, since some platforms need several statements.
Parameters
- $diff : TableDiff|TableDiff
Return values
array<int, string>getColumnDeclarationSQL()
Note that this provides a method override to combine type based comments with the column comment on platforms.
public
getColumnDeclarationSQL(string $name, array<string|int, mixed> $column) : string
Obtains DBMS specific SQL code portion needed to declare a generic type column to be used in statements like CREATE TABLE.
Parameters
- $name : string
-
The name the column to be declared.
- $column : array<string|int, mixed>
-
An associative array with the name of the properties of the column being declared as array indexes. Currently, the types of supported column properties are as follows:
length Integer value that determines the maximum length of the text column. If this argument is missing the column should be declared to have the longest length allowed by the DBMS. default Text value to be used as default for this column. notnull Boolean flag that indicates whether this column is constrained to not be set to null. charset Text value with the default CHARACTER SET for this column. collation Text value with the default COLLATION for this column. columnDefinition a string that defines the complete column
The method should be only used from within the AbstractPlatform class hierarchy.
Return values
string —DBMS specific SQL code portion that should be used to declare the column.
getDefaultValueDeclarationSQL()
Obtains DBMS specific SQL code portion needed to set a default value declaration to be used in statements like CREATE TABLE.
public
getDefaultValueDeclarationSQL(array<string|int, mixed> $column) : string
Oracle MySQL does not support default values on TEXT/BLOB columns until 8.0.13. Doctrine DBAL 4.x supports earlier version of MySQL and decided to unset the column default value for TextType and BlobType generally in the MySQL platform variants. This trait reintroduces the AbstractPlatform implementation to be used in the TYPO3 platform overrides for MySQL to remove this limitation and allow the use of default value as expressions.
Parameters
- $column : array<string|int, mixed>
-
The column definition array.
Tags
Return values
string —DBMS specific SQL code portion needed to set a default value.
getCustomAlterTableSQLEngineOptions()
protected
getCustomAlterTableSQLEngineOptions(MariaDBPlatform|MySQLPlatform $platform, TableDiff|TableDiff $tableDiff, array<int, string> $result) : array<int, string>
Parameters
- $platform : MariaDBPlatform|MySQLPlatform
- $tableDiff : TableDiff|TableDiff
- $result : array<int, string>