Skip to content

Commit

Permalink
[TASK] Use constants for column types definition in DefaultTcaSchema
Browse files Browse the repository at this point in the history
Resolves: #101940
Releases: main, 12.4
Change-Id: Ib8cc5c5bfc886686c1abfe5ed35724e1e268e800
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81043
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Oliver Bartsch <bo@cedev.de>
  • Loading branch information
o-ba committed Sep 18, 2023
1 parent 428a0bd commit 11beaf7
Showing 1 changed file with 36 additions and 35 deletions.
71 changes: 36 additions & 35 deletions typo3/sysext/core/Classes/Database/Schema/DefaultTcaSchema.php
Expand Up @@ -18,6 +18,7 @@
namespace TYPO3\CMS\Core\Database\Schema;

use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\Types;
use TYPO3\CMS\Core\Database\Query\QueryHelper;
use TYPO3\CMS\Core\Database\Schema\Exception\DefaultTcaSchemaTablePositionException;
use TYPO3\CMS\Core\Utility\GeneralUtility;
Expand Down Expand Up @@ -74,7 +75,7 @@ protected function enrichSingleTableFields($tables)
if (!$this->isColumnDefinedForTable($tables, $tableName, 'uid')) {
$tables[$tablePosition]->addColumn(
$this->quote('uid'),
'integer',
Types::INTEGER,
[
'notnull' => true,
'unsigned' => true,
Expand All @@ -92,7 +93,7 @@ protected function enrichSingleTableFields($tables)
'notnull' => true,
'unsigned' => true,
];
$tables[$tablePosition]->addColumn($this->quote('pid'), 'integer', $options);
$tables[$tablePosition]->addColumn($this->quote('pid'), Types::INTEGER, $options);
$pidColumnAdded = true;
}

Expand All @@ -102,7 +103,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote($tableDefinition['ctrl']['tstamp']),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => true,
Expand All @@ -117,7 +118,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote($tableDefinition['ctrl']['crdate']),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => true,
Expand All @@ -132,7 +133,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote($tableDefinition['ctrl']['delete']),
'smallint',
Types::SMALLINT,
[
'default' => 0,
'notnull' => true,
Expand All @@ -147,7 +148,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote($tableDefinition['ctrl']['enablecolumns']['disabled']),
'smallint',
Types::SMALLINT,
[
'default' => 0,
'notnull' => true,
Expand All @@ -162,7 +163,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote($tableDefinition['ctrl']['enablecolumns']['starttime']),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => true,
Expand All @@ -177,7 +178,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote($tableDefinition['ctrl']['enablecolumns']['endtime']),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => true,
Expand All @@ -192,7 +193,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote($tableDefinition['ctrl']['enablecolumns']['fe_group']),
'string',
Types::STRING,
[
'default' => '0',
'notnull' => true,
Expand All @@ -207,7 +208,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote($tableDefinition['ctrl']['sortby']),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => true,
Expand All @@ -234,7 +235,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote($tableDefinition['ctrl']['descriptionColumn']),
'text',
Types::TEXT,
[
'notnull' => false,
'length' => 65535,
Expand All @@ -248,7 +249,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote($tableDefinition['ctrl']['editlock']),
'smallint',
Types::SMALLINT,
[
'default' => 0,
'notnull' => true,
Expand All @@ -263,7 +264,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote((string)$tableDefinition['ctrl']['languageField']),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => true,
Expand All @@ -279,7 +280,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote((string)$tableDefinition['ctrl']['transOrigPointerField']),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => true,
Expand All @@ -295,7 +296,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote((string)$tableDefinition['ctrl']['translationSource']),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => true,
Expand All @@ -312,7 +313,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote('l10n_state'),
'text',
Types::TEXT,
[
'notnull' => false,
'length' => 65535,
Expand All @@ -326,7 +327,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote($tableDefinition['ctrl']['origUid']),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => true,
Expand All @@ -341,7 +342,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote($tableDefinition['ctrl']['transOrigDiffSourceField']),
'blob',
Types::BLOB,
[
// mediumblob (16MB) on mysql
'length' => 16777215,
Expand All @@ -357,7 +358,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote('t3ver_oid'),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => true,
Expand All @@ -373,7 +374,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote('t3ver_wsid'),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => true,
Expand All @@ -389,7 +390,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote('t3ver_state'),
'smallint',
Types::SMALLINT,
[
'default' => 0,
'notnull' => true,
Expand All @@ -405,7 +406,7 @@ protected function enrichSingleTableFields($tables)
) {
$tables[$tablePosition]->addColumn(
$this->quote('t3ver_stage'),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => true,
Expand Down Expand Up @@ -439,15 +440,15 @@ protected function enrichSingleTableFields($tables)
if (($fieldConfig['config']['relationship'] ?? '') === 'oneToMany') {
$tables[$tablePosition]->addColumn(
$this->quote($fieldName),
'text',
Types::TEXT,
[
'notnull' => false,
]
);
} else {
$tables[$tablePosition]->addColumn(
$this->quote($fieldName),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => true,
Expand Down Expand Up @@ -477,7 +478,7 @@ protected function enrichSingleTableFields($tables)
} else {
$tables[$tablePosition]->addColumn(
$this->quote($fieldName),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => !($fieldConfig['config']['nullable'] ?? false),
Expand All @@ -497,7 +498,7 @@ protected function enrichSingleTableFields($tables)

$tables[$tablePosition]->addColumn(
$this->quote($fieldName),
'string',
Types::STRING,
[
'length' => 2048,
'notnull' => false,
Expand All @@ -515,7 +516,7 @@ protected function enrichSingleTableFields($tables)

$tables[$tablePosition]->addColumn(
$this->quote($fieldName),
'json',
Types::JSON,
[
'notnull' => false,
]
Expand All @@ -532,7 +533,7 @@ protected function enrichSingleTableFields($tables)

$tables[$tablePosition]->addColumn(
$this->quote($fieldName),
'string',
Types::STRING,
[
'length' => 36,
'default' => '',
Expand Down Expand Up @@ -595,7 +596,7 @@ protected function enrichMmTables($tables): array
if ($hasUid && !$this->isColumnDefinedForTable($tables, $mmTableName, 'uid')) {
$tables[$tablePosition]->addColumn(
$this->quote('uid'),
'integer',
Types::INTEGER,
[
'notnull' => true,
'unsigned' => true,
Expand All @@ -608,7 +609,7 @@ protected function enrichMmTables($tables): array
if (!$this->isColumnDefinedForTable($tables, $mmTableName, 'uid_local')) {
$tables[$tablePosition]->addColumn(
$this->quote('uid_local'),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => true,
Expand All @@ -623,7 +624,7 @@ protected function enrichMmTables($tables): array
if (!$this->isColumnDefinedForTable($tables, $mmTableName, 'uid_foreign')) {
$tables[$tablePosition]->addColumn(
$this->quote('uid_foreign'),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => true,
Expand All @@ -638,7 +639,7 @@ protected function enrichMmTables($tables): array
if (!$this->isColumnDefinedForTable($tables, $mmTableName, 'sorting')) {
$tables[$tablePosition]->addColumn(
$this->quote('sorting'),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => true,
Expand All @@ -649,7 +650,7 @@ protected function enrichMmTables($tables): array
if (!$this->isColumnDefinedForTable($tables, $mmTableName, 'sorting_foreign')) {
$tables[$tablePosition]->addColumn(
$this->quote('sorting_foreign'),
'integer',
Types::INTEGER,
[
'default' => 0,
'notnull' => true,
Expand All @@ -665,7 +666,7 @@ protected function enrichMmTables($tables): array
if (!$this->isColumnDefinedForTable($tables, $mmTableName, 'tablenames')) {
$tables[$tablePosition]->addColumn(
$this->quote('tablenames'),
'string',
Types::STRING,
[
'default' => '',
'length' => 64,
Expand All @@ -676,7 +677,7 @@ protected function enrichMmTables($tables): array
if (!$this->isColumnDefinedForTable($tables, $mmTableName, 'fieldname')) {
$tables[$tablePosition]->addColumn(
$this->quote('fieldname'),
'string',
Types::STRING,
[
'default' => '',
'length' => 64,
Expand Down

0 comments on commit 11beaf7

Please sign in to comment.