Project

General

Profile

Actions

Bug #105498

open

Nullable table fields can not be migrated (ALTERed) to "NOT NULL" in an update from v12 to v13

Added by Benjamin Franzke 3 days ago. Updated 1 day ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Install Tool
Start date:
2024-10-28
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
13
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Example: fe_users.image
This field has been changed from TINYTEXT DEFAULT NULL (in v12) to INT UNSIGNED DEFAULT NOT NULL (in v13).

That means the following ALTER TABLE statement is generated:

ALTER TABLE `fe_users` CHANGE `image` `image` INT UNSIGNED DEFAULT 0 NOT NULL

Which fails with:

 Error: Data truncated for column 'image' at row 1

When there are columns (which was fine in v12) with null values:

select uid, pid, username, image from fe_users;
+-----+------+--------------------------+-------+
| uid | pid  | username                 | image |
+-----+------+--------------------------+-------+
|   1 |  178 | styleguide-frontend-demo | NULL  |
|   2 |  205 | styleguide-frontend-demo | NULL  |
|   3 |  771 | example_user             | NULL  |
|   4 | 1008 | admin                    | 0     |
|   5 | 1013 | admin                    | NULL  |
+-----+------+--------------------------+-------+

Desired solution:

There should be an upgrade wizard that runs prior to this database updates, that sets all values of current nullable fields to the schema default value, when the desired schema is a non-nullable field with a default value.

Actions

Also available in: Atom PDF