Updating from alpha1 to alpha2 seems to fail because of the changes in eck.schema.yml (https://www.drupal.org/node/2797775).
All entity types created through ECK get a field mismatch error (https://www.drupal.org/node/2554101) on the ID column. The change from mapping to config_entity type alters the 'Unsigned' value of each ID field (from false to true) and Drupal will not update fields with data.
I tried to manually enable the unsigned value for the id fields but since the last used configuration is in key_value storage Drupal does not notice that the unsigned bit is actually ok now. How to update the values in the key_value store with the actual field/table config is beyond me. Running drush entity-updates
does not do the trick here either.
Steps to reproduce:
- Start from alpha1 version
- Create a entity type, bundle and add an entity for that bundle
- Update the module to alpha2
- Check the drupal status report for mismatch errors on the ID base field for the entity type
I fixed the issue for now by reverting to alpha1 (which makes the errors go away)
Comment | File | Size | Author |
---|---|---|---|
#6 | changes_to-2825407-6.patch | 1.47 KB | legolasbo |
Comments
Comment #2
legolasboI've managed to reproduce the issue. Let's see if we can fix it.
Comment #3
legolasboThis issue is actually introduced in #2825144: Refactor EckEntity.php instead of #2797775: Simplify eck.schema.yml.
Attached patch adds an update path. Please test this thoroughly on a backed-up database as I've only tested it on a single entity type.
Comment #4
OnkelTem CreditAttribution: OnkelTem at Adyax commentedThe patch hasn't worked for my case.
It fails on applying updates in
eck_update_8005()
with the error:
SQLSTATE[22004]: Null value not allowed: 1138 Invalid use of NULL value: ALTER TABLE {author} CHANGE `id` `id` INT unsigned NOT NULL;
It first deletes ID field (!) from both tables (which is indeed a wrong thing to do), and then adds it back with obviously NULL values, but since it can not be NULL according to its definition the operation fails.
Comment #5
OnkelTem CreditAttribution: OnkelTem at Adyax commentedSharing my solution instead.
WARNING: this hook is mysql-specific!
Comment #6
legolasboSo I've taken the suggestion from #5 and adjusted it to use Drupal's database abstraction layer. This is a far cleaner solution! please test so we can quickly commit and roll an alpha3
Comment #7
OnkelTem CreditAttribution: OnkelTem at Adyax commentedThank you, it looks much better now! I've never been good with Drupal Schema :^)
Can't test it though - have no old database by hand, but I hope other uses might check it out soon.
Comment #8
KarlSheaWorked for me!
Comment #9
tim.abbott CreditAttribution: tim.abbott commentedWorked for me too, many thanks!
Comment #10
legolasboThanks for the feedback guys. I'll commit this and roll a new alpha asap.
Comment #11
proweb.ua CreditAttribution: proweb.ua commented#6 works
Comment #13
legolasboCommitted and pushed to 8.x-1.x, thanks!
Comment #15
SalAG CreditAttribution: SalAG commentedAre there any solutions for a postgres database, which don't have unsigned int types?
This issue has left me in eck 1.0-alpha 1 for far too long and I think this might hold me back from updating into 8.8 from 8.7.12
Any help appreciated.