Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Entity/field definitions
Mismatched entity and/or field definitions
The following changes were detected in the entity type and field definitions.
OrderThe Order number field needs to be updated.
Payment
The Remote ID field needs to be updated.
Payment method
The Remote ID field needs to be updated.
Product variation
The SKU field needs to be updated.
Steps to reproduce
Proposed resolution
https://www.drupal.org/docs/drupal-apis/update-api/updating-database-sch...
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#7 | 3183315-7-schema-update.patch | 4.36 KB | joelpittet |
|
Issue fork commerce-3183315
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
joelpittetComment #3
joelpittetComment #5
BerdirI commented on #2907367: Add indexes to important fields because that was easier.
Also, if that change is already in HEAD then this is imho at least a major bug.
Comment #6
BerdirNot *quite* the same, but you should just need to do something like this for each affected field:
Comment #7
joelpittetThank you very much @Berdir, it worked very well, the indexes are there and the schema is now updated. I removed
public function onEntityTypeUpdate
Comment #8
joelpittetComment #9
BerdirLooks good to me. The onEntityTypeUpdate() might have created the necessary indexes but didn't update the installed field storage definitions.
I'd love to have a better system for this in core that doesn't require custom storage schemas and this seems like a pretty nice start, but things get a bit more complicated once you need indexes that cover multiple fields or unique indexes, fields with multiple properties (e.g. not sure what would happen with the commerce implementation if you try to put an index on a price field).
Comment #10
Dave KopecekI can confirm the RTBC. Thanks to all who worked on this!
Comment #12
jsacksick CreditAttribution: jsacksick at Centarro commentedCommitted! Thanks!
Comment #14
darrenwh CreditAttribution: darrenwh commentedI've found another field that needs indexing, adding it to field_indexes and the rerunning the update script does not add an index to the additional field, should it do? https://www.drupal.org/project/commerce/issues/3224681