Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.0] Fix an issue with mediumtext type #8127

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Sources/Db/APIs/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ public function add_index(string $table_name, array $index_info, array $paramete
// If a size was already specified, we won't be able to match it anyways.
if (
!isset($cols[$c])
|| !in_array($cols[$c]['type'], ['text', 'mediumntext', 'largetext', 'varchar', 'char'])
|| !in_array($cols[$c]['type'], ['text', 'mediumtext', 'longtext', 'varchar', 'char'])
|| (
isset($size)
&& $size <= 191
Expand Down Expand Up @@ -1573,7 +1573,7 @@ public function create_table(string $table_name, array $columns, array $indexes
if (
$key === false
|| !isset($columns[$key])
|| !in_array($columns[$key]['type'], ['text', 'mediumntext', 'largetext', 'varchar', 'char'])
|| !in_array($columns[$key]['type'], ['text', 'mediumtext', 'longtext', 'varchar', 'char'])
|| (
isset($size)
&& $size <= 191
Expand Down Expand Up @@ -2383,7 +2383,7 @@ protected function create_query_column(array $column): string
// Allow unsigned integers (mysql only)
$unsigned = in_array($type, ['int', 'tinyint', 'smallint', 'mediumint', 'bigint']) && !empty($column['unsigned']) ? 'unsigned ' : '';

if ($size !== null) {
if ($size > 0) {
$type = $type . '(' . $size . ')';
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Db/APIs/PostgreSQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ public function calculate_type(string $type_name, ?int $type_size = null, bool $
'tinyint' => 'smallint',
'tinytext' => 'character varying',
'mediumtext' => 'text',
'largetext' => 'text',
'longtext' => 'text',
'inet' => 'inet',
'time' => 'time without time zone',
'datetime' => 'timestamp without time zone',
Expand Down
Loading