Problem/Motivation

When loading pages after cache tables have been truncated, I'm trying to load my website home page as an anonymous visitor.
A white page is showing a message.
In my PHP logs, this information is returned:

Uncaught PHP Exception Drupal\Core\Database\IntegrityConstraintViolationException: "SQLSTATE[HY000]: General error: 1364 Field 'csid' doesn't have a default value: INSERT INTO "captcha_sessions" ("uid", "sid", "ip_address", "timestamp", "form_id", "solution", "status", "attempts") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array
(
[:db_insert_placeholder_0] => 0
[:db_insert_placeholder_1] =>
[:db_insert_placeholder_2] => 195.86.5.227
[:db_insert_placeholder_3] => 1784554587
[:db_insert_placeholder_4] => webform_submission_contact_node_888_add_form
[:db_insert_placeholder_5] => 439ff7b954df98800c5176f98cb1207ea8a50eabb449e1f682a9f91755b8edb7
[:db_insert_placeholder_6] => 0
[:db_insert_placeholder_7] => 0
)
" at /.../web/core/modules/mysql/src/Driver/Database/mysql/ExceptionHandler.php line 45

Proposed temporary resolution

Regarding to the sql structure of captach_sessions table, it appears that there is no default value for the csid field.
When altering the structure, it work better:
alter table captcha_sessions modify csid int(11) unsigned default 0

Data model changes

alter table captcha_sessions modify csid int(11) unsigned default 0

Issue fork captcha-3612032

Command icon 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:

Comments

frondeau created an issue. See original summary.

aayushpathak made their first commit to this issue’s fork.

aayushpathak’s picture

Assigned: Unassigned » aayushpathak

working on it !

aayushpathak’s picture

Assigned: aayushpathak » Unassigned
Status: Active » Needs review

Fixed by setting 'unsigned' => TRUE on the csid column in captcha_schema(), plus a new captcha_update_8908() hook that re-applies the auto-increment serial definition to existing tables via changeField(). Added a kernel test (CaptchaUpdate8908Test) covering the update path. Please review !