Review main Merged

74362[BUGFIX] Adopt doctrine/dbal sqlite autoincrement detection

Stefan Bürk CR +2 V +2 Normal +43 −13 updated 04/28/22, 05:45

Commit message

sqlite basicly knows about two kind of autoincrement column
definition. One which is an alias on the provided "row_id"
field for an integer field which is also the single field
of the primary key index. And the second one with a real
autoincrement notation, which is not an alias like the first
one. Basicly this differes in some behaviours, mainly that
the second one will never reassign ids which has been deleted.
The first one will eventually reassign deleted ids to fill up
spaces in between.

This counts for inserts where the column data has a null value.
If a real value is provided, this will be used.

"ext:indexed_search" defines some tables with integer columns
which are the primary key, which are not flagged as autoincrement
fields. This is not needed as the inserted data always uses pre
calculated hash values.

This works pretty fine on most dbms. sqlite automatically assumes
the autoincrement field (row_id) alias type for creation, which
works so far pretty well.

doctrine/dbal uses 'PRAGMA table_info(<table-name>)' to read
the table structure, which do not containts the information
if the field is created with the AUTOINCREMENT keyword or not.
Reading the table struncture from a sqlite database sets the
"autoincrement: true" value for colums of type integer, if
they are the only included column of an primary key.

On the other side, reading/building the meta schema based on
the TYPO3 "ext_tables.sql" files of extensions and using the
default table definition building based on TCA, the column
will get "autoincrement: false" if the auto_increment keyword
is not used.

This will popup these tables again and again, as it always will
detect the column as changed, because of the not matching column
autoincrement value.

This patch adopts this assumptions from doctrine/dbal and set the
autoincrement to true, if a table has one primary key colum of
type integer without a autoincremet flag. This will create the
real autoincrement column instead, which is a safer variant for it.

doctrine/dbal added this detection based on these assumptions with:
https://github.com/doctrine/dbal/commit/33555d36e7e7d07a5880e01

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 1

Files 2