[ISSUE-17793] Revert previous change + Fix default selection of uuid in alter table

Signed-off-by: Mo Sureerat <sureemo@gmail.com>
This commit is contained in:
Mo Sureerat 2022-11-03 05:11:19 +07:00
parent f8bee4cd5d
commit ddf928e6f3
3 changed files with 8 additions and 36 deletions

View File

@ -1109,14 +1109,7 @@ class InsertEdit
private function getSpecialCharsAndBackupFieldForInsertingMode(
array $column
) {
$isNullableUUID = ! empty($column['True_Type'])
&& ! empty($column['Default'])
&& ! empty($column['Null'])
&& $column['True_Type'] === 'uuid'
&& $column['Default'] === 'uuid()'
&& $column['Null'] === 'YES';
if ($isNullableUUID || (! isset($column['Default']))) {
if (! isset($column['Default'])) {
$column['Default'] = '';
$realNullValue = true;
$data = '';

View File

@ -243,6 +243,8 @@ final class ColumnsDefinition
case 'NULL':
case 'CURRENT_TIMESTAMP':
case 'current_timestamp()':
case 'UUID':
case 'uuid()':
$columnMeta['Default'] = $columnMeta['DefaultType'];
break;
}
@ -300,6 +302,11 @@ final class ColumnsDefinition
$columnMeta['DefaultType'] = 'CURRENT_TIMESTAMP';
$columnMeta['DefaultValue'] = '';
break;
case 'UUID':
case 'uuid()':
$columnMeta['DefaultType'] = 'UUID';
$columnMeta['DefaultValue'] = '';
break;
default:
$columnMeta['DefaultType'] = 'USER_DEFINED';
$columnMeta['DefaultValue'] = $columnMeta['Default'];

View File

@ -1801,34 +1801,6 @@ class InsertEditTest extends AbstractTestCase
'hello world&lt;br&gt;&lt;b&gt;lorem&lt;/b&gt; ipsem',
],
],
'uuid with nullable' => [
[
'True_Type' => 'uuid',
'Default' => 'uuid()',
'Null' => 'YES',
],
[
true,
'',
'',
'',
'',
],
],
'uuid with not nullable' => [
[
'True_Type' => 'uuid',
'Default' => 'uuid()',
'Null' => 'NO',
],
[
false,
'uuid()',
'uuid()',
'',
'uuid()',
],
],
];
}