Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Fix following test fails with D7 + SQLite
Update succeeded. Other field_sql_storage.test 321 FieldSqlStorageTestCase->testFieldUpdateFailure() Fail
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#3 | 3173220-3.patch | 1.12 KB | mcdruid |
Comments
Comment #2
mcdruidThis one could be tricky.
https://git.drupalcode.org/project/drupal/-/blob/7.73/modules/field/modu...
This relies on an exception being thrown when
field_sql_storage_field_storage_update_field()
callsdb_create_table()
:https://git.drupalcode.org/project/drupal/-/blob/7.73/modules/field/modu...
The query is this:
...and MySQL will throw the following exception through PDO:
Whereas it looks like SQLite will happily create a table with that sort of broken schema:
So no exception is thrown, and test fails because the update succeeds.
I'll check if there's anything obvious we can do to make SQLite more strict about the schema, but perhaps this is one we'll have to skip for SQLite?
Comment #3
mcdruidIn D8/9
\Drupal\KernelTests\Core\Entity\FieldSqlStorageTest::testFieldUpdateFailure
does this:https://git.drupalcode.org/project/drupal/-/blob/9.0.x/core/tests/Drupal...
So a straight backport here should get that test passing in SQLite. Again, no point in having the bot test that just yet, but I've verified it locally.
FWIW with the bracket, SQLite throws this exception:
Comment #4
Fabianx CreditAttribution: Fabianx as a volunteer and at Tag1 Consulting commentedRTBM - Approved. Thanks!
Comment #9
mcdruidAdded credit from, and linked to original issue #2463103: SQLite: Fix system\Tests\Entity\FieldSqlStorageTest
Thanks!