heidkaemper / craft-redactor-anchors

Support for anchors in Craft CMS Redactor
https://plugins.craftcms.com/redactor-anchors
MIT License
10 stars 4 forks source link

Add missing schema version #14

Closed josdigital closed 9 months ago

josdigital commented 9 months ago

The new 1.4.2 version update is causing issues with project config files. When installing the update and applying the project config files I get the following error message:

image

After digging into the database and the project.yaml file I found that everything is correct (the project.yaml schema version for the redactor-anchors plugin is 2.0; the schema version on the plugins table is 2.0 and the schema version on the projectconfig table is 2.0) but the schema version retrieved by Craft is 1.0.0 (the default, set in craftcms/cms/src/base/PluginTrait.php) because the explicit schemaVersion is missing from the plugin. (The code that checks the schema version is on craftcms/cms/src/console/controllers/ProjectConfigController.php:280)

The issue is preventing every kind of project config update to be applied.

Adding public string $schemaVersion = '2.0'; in the plugin declaration fixes the issue.

heidkaemper commented 9 months ago

Thanks for your contribution! With new Craft 3 installations, the plugin had no issues. With existing installations, however, it did throw that schema warning.

Instead of adding schemaVersion to the php file I find it a bit cleaner to add it directly to the composer.json. (In fact, it was already specified there in earlier versions)

The fix is published with v1.4.3. Hopefully everything should work again now.

josdigital commented 9 months ago

Thank you @heidkaemper the new v1.4.3 fixed the issue and everything works again.