Problem/Motivation
As a follow-up to #2841291: Fix NOT NULL handling in the entity storage and 'primary key' changes when updating the storage definition of an identifier field we should remove all manual marking of NOT NULL from various storage schema implementations.
Proposed resolution
- Remove various places that set
'not null' => TRUEon fields in storage schema implementations and mark the respective fields assetStorageRequired(TRUE)instead. - Add an update path for the field updates
- Deprecate the
$not_nullparameter ofSqlContentEntityStorageSchema::addSharedTableFieldIndex()
| Comment | File | Size | Author |
|---|---|---|---|
| #29 | 3003586-29--full.patch | 151.12 KB | mkalkbrenner |
| #28 | 3003586-28--full.patch | 151.08 KB | mkalkbrenner |
| #27 | 3003586-27--full.patch | 151.12 KB | hchonov |
| #27 | 3003586-27--for-review.txt | 57.84 KB | hchonov |
| #19 | 3003586-19--full.patch | 127.5 KB | hchonov |
Issue fork drupal-3003586
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
Comment #2
tstoecklerThis should apply once #2841291: Fix NOT NULL handling in the entity storage and 'primary key' changes when updating the storage definition of an identifier field is in.
Comment #3
jibranThis is a huge DX improvement IMO but to remeber
'not null' => TRUEtosetStorageRequired(TRUE)is not stright forward.Comment #4
tstoecklerOK, so here's a new patch which builds on the latest approach in #2841291: Fix NOT NULL handling in the entity storage and 'primary key' changes when updating the storage definition of an identifier field and updates the storage schema version (which is introduced as a concept over there) to 2.
Possibly this will fail due to #2976040: default_revision can be left around in data table due to broken entity type CRUD, but not sure yet, so leaving it out for now.
Comment #6
tstoecklerHere's my WIP interdiff for this issue, didn't get any further today. Will explain some of the details once I finish this.
Comment #9
geasePlain reroll of full patch from #4 against 8.9.x. Though fully porting patch may need additional work due to #3004642: Deprecate SqlContentEntityStorageSchemaConverter in favor of the new API provided by EntityTypeListenerInterface::onFieldableEntityTypeUpdate()
Comment #11
hchonovI've updated the patch on top of #2841291-229: Fix NOT NULL handling in the entity storage and 'primary key' changes when updating the storage definition of an identifier field and #3083131-28: BaseFieldDefinition::isStorageRequired wrongly falls back to ::isRequired.
The current approach
::setStorageRequired(TRUE)or::setStorageRequired(FALSE)calls on the corresponding base fieldsComment #13
hchonovComment #15
hchonovComment #17
hchonovMy comment.install update was named wrongly - copy paste error.
Comment #19
hchonovWe need to take care explicitly of the overridden base fields of the Workspace entity.
The full patch is based on the updated combined patch from #2841291-231: Fix NOT NULL handling in the entity storage and 'primary key' changes when updating the storage definition of an identifier field and #3083131-28: BaseFieldDefinition::isStorageRequired wrongly falls back to ::isRequired .
Comment #21
hchonovThese fails show the importance of #1894286: System updates are executed without priority. Until it is resolved we need to declare explicitly
hook_update_dependencies()multiple times.Comment #23
hchonov2 more issues emerged out of the previous patch.
The following full patch is based on:
The current approach has not changed and therefore I am no adding an interdiff.
Comment #25
hchonovNow that #3098427: Manipulating the revision metadata keys before running the BC layer breaks the BC layer is green, the following full patch is based on:
The current approach has not changed and therefore I am no adding an interdiff.
Comment #27
hchonovThanks to the fails, I've found out a bug in the patch for #3098430-6: Automatic index creation/deletion does not work if a field storage definition is installed before the entity type is updated, which is fixed in the new version.
I've updated the underlying patches:
The current approach has not changed and therefore I am no adding an interdiff.
Comment #28
mkalkbrenner#27 doesn't apply anymore. I try to re-roll it. Let's wait for the test results.
Comment #29
mkalkbrennerI erroneously re-rolled against 8.8.x. Now for 8.9.x.
Comment #36
smustgrave commentedWill need a reroll for 10.1
And Change Record.
Comment #37
bhanu951 commentedI will work on re-roll