Problem/Motivation
Drupal\Core\Entity\EntityStorageException: SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value: INSERT INTO "block_content" ("revision_id", "type", "uuid", "langcode") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => basic [:db_insert_placeholder_2] => f6a5803b-9ef7-4941-a0db-6df8916eaa19 [:db_insert_placeholder_3] => it ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (linea 815 di /home/********/website/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Steps to reproduce
Upgraded website from Drupal 8.9.20 to Drupal 9.5.9
Anyone who had faced same issue?
Comments
Comment #2
cilefen commentedThe site probably missed a schema update.
Comment #3
Niubbo75 commented@cilefen how can I upgrade schema?
Thanks for your reply.
Comment #4
catch@Niubbo75 this means running updates - either from update.php, or drush updb.
Comment #5
Niubbo75 commented@catch done yet, but nothing to update.
Comment #6
Niubbo75 commentedSolved, I manually add keys that were lost, now seems that all works.
I use another DB of another installation that work to compare tables and keys.
Best regards,
Alessandro
Comment #7
Niubbo75 commentedComment #9
devkinetic commentedI ran into this as well on a recent upgrade from Drupal 8 -> 9 -> 10. We ended up having to do a full database audit and found multiple issues, Before doing so we attempted the entire upgrade again so there is absolutely something missing in the upgrade path:
We solved the issue with the audit, and fixing the schema manually. I saw the referenced error about the users table, and can confirm that that update was ran but didn't fix things. I guess something to look out for when upgrading!