Closed dialedin-team closed 12 months ago
Hello everyone,
I'm experiencing the same problem as well. Could someone assist us in finding a solution to this issue?
Thanks in advance.
Hi @dialedin-team, I'm not sure why I missed your original issue so apologies for the late reply. @thangaraj-moorthi thanks for following up.
The schemaVersion is used to tell Craft that there have been changes to the database/plugin data model. These issues usually occur when something has gone wrong during an update and the schema version that Craft has saved has gotten out of sync.
How exactly are you updating? Did you first run the update on your local machine then push the changes to production? Are you updating via the Craft UI are via the command line?
Hi @timmyomahony,
We are updating the plugin via both Craft UI (updates) and also the command line (php craft update matrix-field-preview). Both methods only update composer files(composer.json,composer.lock) But, the plugin's schemaVersion is specified in the project.yml file; how is it updated in that file?. Is it necessary to manually update the schema version every time, or is there an automated way to manage it?
Thanks in advance.
As you've pointed out, the issue here seems to be that the project.yaml
hasn't been properly updated locally, before it was pushed to production. This is causing the mismatch between the installed version of the plugin on your production machine and the project.yaml
on your production machine.
When you updated the plugin locally, project.yaml
should have been updated by Craft (with the new schemaVersion
) and then committed to git. It's not clear why this didn't happen.
There are a number of options that should work:
project.yaml
as you mentionedschemaVersion
gets updated.In the meantime, I'm going to do a bit of testing to see if I can replicated. When I tested the latest version, my project.yaml
was updated correctly.
Hi @timmyomahony,
Thank you for the information. We tested it in a fresh Craft system, and it's working as expected. However, one thing I noticed is that when attempting to downgrade a plugin using Composer, the schema version does not revert to previous versions or the older schema once it has been upgraded.
Is this how it will work?
Here is the detailed information about the issue.
We updated the plugin to the latest version, which updated the schema from 3.0.2 to 3.0.3. Afterward, we committed the changes in Git and pushed them. Later, we reverted to the previous commit, causing the schema version in the project.yml file to revert to 3.0.2. However, when we updated the plugin again using craft ui, the schema version did not upgrade to 3.0.3.
Appreciate your help.
Thanks.
Thank you for the information. We tested it in a fresh Craft system, and it's working as expected. However, one thing I noticed is that when attempting to downgrade a plugin using Composer, the schema version does not revert to previous versions or the older schema once it has been upgraded.
I think this might be a question best directed at the Craft CMS Discord or similar, as I'm not sure how down grading works specifically with the schemaVersion
. I imagine you would need to walk-back migrations before downgrading.
Regardless, you should be sure you are performing upgrades in a consistent way between local and production. This is a good blog post on the topic: https://nystudio107.com/blog/updating-craft-cms-without-headaches. You should either use the Craft UI or manually update with composer
an ./craft
commands (for migrations and project.yaml
updates).
We updated the plugin to the latest version, which updated the schema from 3.0.2 to 3.0.3. Afterward, we committed the changes in Git and pushed them. Later, we reverted to the previous commit, causing the schema version in the project.yml file to revert to 3.0.2. However, when we updated the plugin again using craft ui, the schema version did not upgrade to 3.0.3.
So is the plugin now working correctly? You mentioned the schema version being correctly updated to 3.0.3 It sounds like this is a separate issue now regarding downgrading.
EDIT: Bear in mind that the schemaVersion
is tracked within the database in the plugins
table. There is also the migrations
table to see what migrations have been applied.
Just checking in on this issue to see if you got everything working OK?
Hi @timmyomahony It's working fine now. We manually updated the schema version. Thank you!
Excellent, glad you got it working. Let me know if there's any further issues.
I recently upgraded the craftcms version from 4.5.4 to 4.5.6.1 and also I've updated the Matrix Field Preview plugin from version 4.0.6 to 4.1.0. However, I encountered an issue when attempting to apply changes to the project config YAML. The error message stated, 'Your project config YAML files are expecting different versions to be installed for the following: Matrix Field Preview. Try running 'composer install' from your terminal to resolve. Unfortunately, when I ran the 'composer install' command, there were no installations, updates, or removals required.
What does the term 'plugin's schema' refer to, and what is the underlying problem? I managed to resolve the issue by manually updating the schemaVersion from 3.0.2 to 3.0.3 in project.yml. Is this manual schema version update necessary every time, or is there an automated way to handle it?