Problem/Motivation

Since #2951242: Allow BaseFieldDefinition::setInitialValueFromField() to set a default value - this fixes issues with block_content_update_8400(), it is possible that a database field schema specification to have both initial and initial_from_field set, which means that two update queries will be executed to set the initial value when the field is added to the table.

Proposed resolution

Change the execution order so only one update query is performed.

Remaining tasks

Review.

User interface changes

Nope.

API changes

Nope.

Data model changes

Nope.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amateescu created an issue. See original summary.

amateescu’s picture

Status: Active » Needs review
FileSize
2.49 KB

This should do it.

amateescu’s picture

timmillwood’s picture

Status: Needs review » Reviewed & tested by the community

LGTM

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Nice one less query on updates where initial_from_field is set. As we're about to have lots of updates run applied to 8.6.x as well I've backported this very non-disruptive change to 8.6.x

Committed and pushed bc328489db to 8.7.x and 86e0dbeb57 to 8.6.x. Thanks!

  • alexpott committed bc32848 on 8.7.x
    Issue #2990118 by amateescu: Optimize 'initial' and 'initial_from_field...

  • alexpott committed 86e0dbe on 8.6.x
    Issue #2990118 by amateescu: Optimize 'initial' and 'initial_from_field...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.