- Issue created by @glynster
- π¨π¦Canada mandclu
Also the first error message makes it sound like it listed the changes that were detected. If you could include those, that would be helpful.
- πΊπΈUnited States glynster
Hey @mandclu, thank you for responding.
Yes, we also executed the command `drush updb`, and we observed the required update, which ran successfully.The initial error is the one displayed on the Drupal Status Page.
The second error occurs when we run the command `drush entity-updates`, which typically resolves the problem. Is there anything else I can include in Devel to generate more informative error messages?
- π¨π¦Canada mandclu
Apologies, I don't think I explained myself very well. The first error in the issue summary ends with this line:
The following changes were detected in the entity type and field definitions.
I assume that the error listed detected changes below that. Could you add those in?
- π¨π¦Canada chrisck Vancouver, BC π¨π¦
Just reporting that we're seeing the same error in the Status page. Not 100% sure when exactly this happened, but could be due to an update.
Mismatched entity and/or field definitions
The following changes were detected in the entity type and field definitions.Content
The node.field_event_datetime field needs to be updated. - πΊπΈUnited States glynster
@mandclu sorry you are right but that is due to another entity mis-match issue related to the media module!
The node.field_image_media field needs to be updated.
So at this time is there anything else I can supply that might be helpful.
- π¨π¦Canada mandclu
Would either of you be able to tell me what version of Smart Date you originally installed? You could probably find it in a git blame on your composer.json
- πΊπΈUnited States glynster
This project goes back to 2019.
"name": "drupal/smart_date", "version": "3.1.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/smart_date.git", "reference": "3.1.0" },
Is that what you need?
- π¨π¦Canada mandclu
Yes, that is the information I was after. Thanks for that. If you look in the database at your field_datetime table, what column is it using for value and end_value?
- πΊπΈUnited States glynster
Here is a screenshot with all the table info.
- π¨π¦Canada mandclu
Interesting. The schema update I know of (moving the value fields to bigint) look like they have applied as expected. It may take some digging to figure out the perceived differences
- πΊπΈUnited States glynster
Right, makes sense as the update did perform without a failure. If you need me to run any tests let me know.
I do have another website on
Smart Date 4.0.3
which I can test on upgrading to4.1.0-rc2
. I am pretty sure that site was using the same base as this example. - π¨π¦Canada chrisck Vancouver, BC π¨π¦
We first installed Smart Date 3.5.0, and then four weeks ago upgraded to 4.1.0-beta1. We've been keeping up with regular updates.
- πΊπΈUnited States glynster
Interesting I cannot run the cron and get this:
The website encountered an unexpected error. Please try again later. Error: Call to a member function getColumns() on bool in Drupal\Core\Entity\Query\Sql\Tables->addField() (line 246 of core/lib/Drupal/Core/Entity/Query/Sql/Tables.php). Drupal\Core\Entity\Query\Sql\Condition->compile(Object) (Line: 176) Drupal\Core\Entity\Query\Sql\Query->compile() (Line: 81) Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 285) Drupal\smart_date_recur\Entity\SmartDateRule->getParentEntity(1) (Line: 786) smart_date_recur_cron() (Line: 335)
Perhaps this is what helps us solve the issue?
- πΊπΈUnited States glynster
@mandclu is there anything else I can help with on this?
- πΊπΈUnited States glynster
Some updates for you:
- To get the cron working again I have to delete the recurring instances. Luckily this was a site where all past events had been and gone and were no longer published. Then the cron ran without issue.
- We then deleted the field_datetime smart date field and added it back using the same machine name, cleared caches and this resolved the Mismatch issue. Not ideal as it wipes out all the dates.
- We were then able to do a drush cex and push this to live.
Not an ideal situation unless you can remove the data.
We also tried to save the storage settings for the field but would always get the same error message:
The SQL storage cannot change the schema for an existing field (field_datetime in node entity) with data.
- π§πͺBelgium bramvandenbulcke
I'm in the same situation.
The error started showing on two installs after upgrading from 4.0.x to 4.1.x. This had one db update (increase_column_storage): this update applied cleanly. On one install, in development phase, I could remove the field and add it again. Another install has already more than 1000 nodes, so this one will be more tricky. I guess the client won't notice, as everything is still functioning as before. The installation in development phase has one language, the other is multilingual. Both installs use the same field (field_date) on two content types.
Errors:
- Status report: Mismatched entity and/or field definitions. The following changes were detected in the entity type and field definitions. Content: The node.field_date field needs to be updated.
- When trying to resave the field: An error occurred while saving the field: The SQL storage cannot change the schema for an existing field (field_date in node entity) with data.
I also add the schema info.
- π¨π¦Canada mandclu
I'm tempted to close this issue as a duplicate of π node.field_[name] field needs to be updated Needs review but there's been some good discussion in here, so I'll hold off for now. That issue does have a patch, and links to the core issues with a patch available (you only need the patch from one) that allow the stored schemas to be updated to match the updated database structure.
Theoretically another possible approach would be: create a new Smart Date field, and migrate the existing data into the new field using Smart Date's drush command. Then, delete and re-add the original field, and migrate the data back. After validating that everything is working as intended, delete the interim field. The biggest problem with this workaround is that I'm not sure the drush command was designed to copy over recurring information, so it might need an updated to be up to the task.
Ultimately my preference would be to get β¨ Provide a flag to allow updates to stored schema for fields Fixed committed, which requires finishing the associated test. With that in core, we could commit π node.field_[name] field needs to be updated Needs review and get these schema update issues properly resolved.
- π§πͺBelgium bramvandenbulcke
Thanks for linking the other issues!
The module smart_date_recur is not installed in my case.
- π¨π¦Canada mandclu
Apologies for the confusion. The fix in that issue applies to the main Smart Date module, not smart_date_recur. I have updated that issue's metadata to reduce confusion.
- πΊπΈUnited States glynster
@mandclu just wanted to give you some feedback.
As our setup was from 2019, we had many nodes. We applied the 2 proposed patches:
β¨ Provide a flag to allow updates to stored schema for fields Fixed
π node.field_[name] field needs to be updated Needs reviewAnd this resolved the problem, allowing the schema to fully update and keep all the data intact. Super easy and a huge help!