Problem/Motivation
Update dblog_update_10101 fails with SQLite
Steps to reproduce
When upgrading to Drupal 10.1, I couldn't complete the database updates because of this error:
> [notice] Update started: dblog_update_10101
> [error] Unable to parse the column type TINYINT
> [error] Update failed: dblog_update_10101
This could be because I'm using SQLite instead of MySQL.
Proposed resolution
Follow what was done in #3215062: Update hook_schema for Y2038 and skip for SQLlite.
Remaining tasks
Review
Commit
User interface changes
API changes
Data model changes
Release notes snippet
This is also blocking all other database updates.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | Screenshot from 2023-07-02 14-27-49.png | 17.52 KB | bogdog400 |
Issue fork drupal-3370560
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3370560-update-failed-dblogupdate10101
changes, plain diff MR !5459
Comments
Comment #2
bogdog400 commentedIs it possible to change out the TINY size for the severity field:
https://api.drupal.org/api/drupal/core%21modules%21dblog%21dblog.install...
????
Comment #3
cilefen commentedComment #4
cilefen commentedLook into the schema type mappings in core/modules/sqlite/src/Driver/Database/sqlite/Schema.php, in the getFieldTypeMap function.
Comment #5
bogdog400 commentedWhen I look there, I see a perfectly good mapping from 'tiny' to "INTEGER.'
This must be somewhere else.
https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/sqlit...
Comment #6
catchIncreasing priority in case this is affecting more installs.
Comment #7
bogdog400 commentedDoes anyone have a suggestion for how I might turn off just this database update? Apparently it used to be possible to do focused updates with drush, but not any more.
TIA
Comment #8
catch@bogdog400 if you just want to disable the update, add an early return (i.e.
return;) at the top of the function, that way it will be registered as finished and won't run again. Obviously you're on your own for updating the dblog scheme in that case, but for dblog you could uninstall and re-install too.Comment #9
bogdog400 commentedOkay. I did that.
It looks like I'm okay until 2038 and the time coordinates get too long. At least that's my guess.
BTW, I looked at uninstalling dblog, but that option isn't available because it's greyed out. The check is locked.
Any suggestions for the best way to update this schema?
Comment #10
catchDo you have any modules installed that depend on dblog? It should say why it can't be uninstalled.
Adding a related issue that appears to be the same error. Can you post which version of sqlite you have installed?
Comment #11
bogdog400 commentedIt looks like the migrate module requires it.
But none of the migrate modules can be uninstalled. I'm not sure why.
Database Version 3.37.2
System SQLite
Thx.
Comment #12
bogdog400 commentedNote: this documentation says that SQLite doesn't have a fixed length.
"In contrast, a SqlLite "integer" can hold whatever you put into it: from a 1-byte char to an 8-byte long long."
https://stackoverflow.com/questions/7337882/what-is-the-difference-betwe...
Does this affect this issue?
Comment #13
catch@bogdog400 are you sure you're looking at the uninstall tab and not the main extend listing? You can only uninstall modules from the uninstall tab.
If this is the case it might be we should entirely skip this update on sqlite - i.e. even if it works flawlessly it'd be a no-op, but I haven't checked this since I'm not supposed to be working today.
Comment #14
bogdog400 commentedI put a screen shot below. THere's nothing to uninstall.
Comment #16
quietone commented@sonam_sharma, credit has been removed per How is credit granted for Drupal core issues.
Comment #17
cilefen commentedIIRC the uninstall UI cannot search by machine name. Try “database”.
Comment #18
bogdog400 commentedAh..... yes. That worked. Thanks!
Comment #19
dagmarSo the problem here is with the update but not with the fresh install? We ran all the tests for Sqlite, Mysql and Postgres https://www.drupal.org/project/drupal/issues/3081144#comment-15012792 is this a lack of tests?
Comment #20
catch@bogdog400 can you tell us which sqlite version you're running? (from the status report, to ensure it's the one that PHP is actually using, sometimes there can be multiple sqlite versions on one machine).
Comment #21
bogdog400 commentedVersion
3.37.2
of SQLite
Happy to run other tests too, but I'm on vacation next week.
Comment #22
bogdog400 commentedBTW, I'm running on an ARM server, in the odd case that might make a difference.
Comment #23
quietone commentedOver in #3215062: Update hook_schema for Y2038 daffie explains why it is not necessary to change the field definition for SQLlite integers. Their input starts at #19 and the summary is in #31. For me, that means that the
dblog_update_10101should skip SQLlite as doesdblog_update_10100Adding related issues, including #301038: Add a cross-compatible database schema introspection API which is said to resolve this.
Comment #25
quietone commentedRestoring issue summary
Comment #26
quietone commentedThe failing tests are FunctionalJavascript one so probably random.
Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayBlockFormTest::testBlocks
Failed asserting that a NULL is not empty.
Comment #27
daffie commentedBack to needs work.
Comment #28
quietone commented@daffie, thanks for the review!
I removed the skip so this test will run with all the dbs. Also, ran the tests for all the dbs as well.
Random fail in Drupal\Tests\field_ui\FunctionalJavascript\ManageFieldsTest
Comment #29
daffie commentedAll the changes look good to me.
For me it is RTBC.
Comment #33
catchCommitted/pushed to 11.x and cherry-picked to 10.2.x and 10.1.x, thanks!