Bug #71774

Download SQL Dump fails

Added by Fernando Arconada almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Start date:
2015-11-22
Due date:
% Done:

0%

TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

I you got to extension module and click over "Download SQL Dump" of filemetadata
you will get inserts like this:

with 3 files and filemetadata not installed

INSERT INTO sys_file_metadata VALUES (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO sys_file_metadata VALUES (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO sys_file_metadata VALUES (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

if filemetadata installed

INSERT INTO sys_file_metadata VALUES ('1', '', '', '', '', '', '', '', '', '', '', '', '', '0.00000000000000', '0.00000000000000', '0', '0', '0', '', '', '0', '', '0', '', '');
INSERT INTO sys_file_metadata VALUES ('1', '', '', '', '', '', '', '', '', '', '', '', '', '0.00000000000000', '0.00000000000000', '0', '0', '0', '', '', '0', '', '0', '', '');
INSERT INTO sys_file_metadata VALUES ('1', '', '', '', '', '', '', '', '', '', '', '', '', '0.00000000000000', '0.00000000000000', '0', '0', '0', '', '', '0', '', '0', '', '');

My sys_file_metadata table have 3 records

History

#1 Updated by Riccardo De Contardi almost 4 years ago

  • Target version changed from 7 LTS to Candidate for patchlevel

#2 Updated by Jigal van Hemert almost 4 years ago

Just tested this, but after deactivating filemetadata the dump is the same as with filemetadata activated: the second example in your description.

#3 Updated by Morton Jonuschat almost 4 years ago

  • Status changed from New to Closed

Actually what you are seeing is not a bug but the result of changing database default values depending on wether filemetadata was/is installed. The table sys_file_metadata is provided by the core with all fields defined as optional and having NULL as a default value. So when you install TYPO3 and the first couple of files get added to the FAL you end up with a row of all NULL values in sys_file_metadata for each of the files. Now you download the SQL dump and you get your first result.

Then you install filemetadata which includes a more comprehensive version of the table sys_file_metadata which includes default values. Upon installing the extension the schema migration is performed an all existing rows which have NULL values get updated according to constraints like 'NOT NULL DEFAULT <something>'. Given you now download the SQL dump you end up with the second version, even if no new files got added.

This SQL dump will not change even when you remove the filemetadata extension in the next step and revert the schema changes. This is du to the database fields now containing a value, even if it's the previous default value. The DBMS has no safe way to revert the column values to NULL as it can't decide if it's a default value or user supplied input in there. So when you download the SQL dump after removing filemetadata you will stay with version 2 of your dump.

You can even end up with a mix of all NULL and values if you now add new files, new rows will be all NULL again.

In the end you'll always end up with what's actually stored in the database, so the dump is not broken.

Also available in: Atom PDF