Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when a core plugin was disabled during piwik core update, the core plugin's update was not actually executed? #11221

Closed
evgeny-grushko opened this issue Jan 18, 2017 · 19 comments · Fixed by #15815
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Milestone

Comments

@evgeny-grushko
Copy link

evgeny-grushko commented Jan 18, 2017

Error during creating goals on site: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'description' in 'field list'

Piwik version 3.0.1

@sgiehl
Copy link
Member

sgiehl commented Jan 18, 2017

Updated Piwik or new install?

@evgeny-grushko
Copy link
Author

I have used old Piwik database, but delete all files and install it from start. So it is similar to new install

@michaelschulze
Copy link

Same problem here.
I installed PIWIK 3 new, but used an old PIWIK 2 database for transferring existing data.
Update to PIWIK 3.0.1 didn't help.
Error occurs when I try to create a goal.

@tsteur
Copy link
Member

tsteur commented Feb 12, 2017

try to execute a SQL query like this ALTER TABLE piwik_goal ADD description varchar(255) NOT NULL DEFAULT ''. I presume the goal plugin was not enabled when you did the update.

@sgiehl @mattab there might be a bug in our updater. I presume when updating core that it also sets all core plugins to that new core version. However, when the plugin was disabled, the update was not actually executed. So either for core plugins we need to manage the updates in "core" updates or we need to fix to record new version only for activated core plugins.

@michaelschulze
Copy link

That worked for me! Thanks a lot!

@mattab mattab changed the title SQLSTATE[42S22]: Column not found: 1054 Unknown column 'description' in 'field list' when a core plugin was disabled during piwik core update, the core plugin's update was not actually executed? Feb 20, 2017
@mattab mattab added the Bug For errors / faults / flaws / inconsistencies etc. label Feb 20, 2017
@mattab mattab added this to the 4.0.0 milestone Feb 20, 2017
@tsteur
Copy link
Member

tsteur commented Mar 6, 2017

See #11438 the same also applies not only for core plugin updates but also to the dimension updates

@sgiehl
Copy link
Member

sgiehl commented Mar 2, 2020

@tsteur might that be fixed meanwhile? Did some local testing and for me the version of deactivated plugins didn't change in db. And when activating the after the update they triggered the included migrations / dimension updates that weren't executed

@tsteur
Copy link
Member

tsteur commented Mar 2, 2020

@sgiehl if you tested it, and updates of a deactivated plugin are executed later, then feel free to close it. Might be good to test with deactivated non-core plugins and deactivated core plugin.

@tsteur
Copy link
Member

tsteur commented Apr 15, 2020

Haven't tried to reproduce it but problem seems to be maybe in https://github.com/matomo-org/matomo/blob/3.13.5-b1/core/Updater.php#L525 where it only returns loaded plugins and after deactivating Goals plugin it wasn't appearing there.

Was then executing this query: update piwik_option set option_value = '3.13.4' where option_name like 'version_%' and option_value = '4.0.0-b1'

and adding an update for goals plugin:

image

The update did not appear in the updater screen

image

but the goals plugin remained on the correct version
image

Then enabled the goals plugin and the component version was increased without actually executing the plugin update.

image

@tsteur
Copy link
Member

tsteur commented Apr 15, 2020

Actually, I tried it now multiple times and things always worked nicely. No matter if I activate the plugin manually in config file

image

or whether I activate it through the UI.

The only problem I can see is if the plugin was never marked as installed in the first place then it would maybe falsely record a new version directly https://github.com/matomo-org/matomo/blob/3.13.5-b1/core/Plugin/Manager.php#L1352

This is because the installer assumes that the plugin will install all columns. However, in case of the goals plugin initially core would install the plugin, but goals would only have an update. Basically, we generally either put all install and update logic into a core plugin, or into the core itself but shouldn't mix it.

I think part of this issue be maybe more that we write a test to not have any plugin updates for core plugins but rather define them in core/Updates

@tsteur tsteur self-assigned this Apr 15, 2020
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Sep 28, 2020
@tassoman
Copy link
Contributor

Just a note to say I'm in exact situation in a 3.13.0 installation

@sgiehl
Copy link
Member

sgiehl commented Dec 16, 2020

@tassoman you mean an update wasn't executed when updating to 4.x ? There actually shouldn't be any updates for core plugins, are there?

@tassoman
Copy link
Contributor

Sorry for being late, I lost this notification. I mean 3.13.0 was installed but didn't get any SQL update since then.
Can't say for the 4.x branch, we're not testing, yet.

@ehermontesinos
Copy link

Hi,

I am having the same problem when I try to upgrade from version 3.5.1 to version 4.2.1. The update process by launching the console core: update command ends correctly but I get the following message that is repeated several times:

The error was: SQLSTATE [42S22]: Column not found: 1054 Unknown column 'location_region' in 'piwik_log_visit'
* /var/www/matomo/core/Columns/Updater.php:
Error trying to execute the migration 'ALTER TABLE piwik_log_visit MODIFY COLUMN visitor_count_visits INT (11) UNSIGNED NOT NULL DEFAULT 0, MODIFY COLUMN visit_total_interactions MEDIUMINT UNSIGNED DEFAULT 0, MODIFY COLUMN referer_name VARCHAR (255) COLUMN referer_url VARCHAR (1500) NULL, MODIFY COLUMN config_browser_name VARCHAR (40) NULL, ADD COLUMN config_client_type TINYINT (1) NULL DEFAULT NULL, MODIFY COLUMN location_region char (3) DEFAULT NULL, MODIFY COLUMN` char (3) DEFAULT NULL; '.
The error was: SQLSTATE [42S22]: Column not found: 1054 Unknown column 'location_region' in 'piwik_log_visit'

To solve this what is supposed to be done? Comment the line in the config.ini.php Plugins [] = "CorePluginsAdmin" so that it does not do the plugin update check?

Best regards

@sgiehl
Copy link
Member

sgiehl commented Mar 10, 2021

@ehermontesinos The location_region column actually should already haven been there since version 1.9. So maybe there was already a problem before, so the column didn't exist. You can try to create the column manually, so the update works correctly.

@ehermontesinos
Copy link

Thank you very much for the answer @sgiehl

I have reviewed the corresponding table piwik_log_visit and it already has that field added in version 3.5.1 which is where I am currently.

It is true that before showing these errors when launching an ALTER TABLE, a message of "Error during plugin update" appears much higher up.

It is also true, when I did a test on the Test environment that we have, when updating, Matomo showed me on the screen that a series of plugins are not compatible with version 4.2.1, indicating that they will be updated if there is a version available in the Marketplace and otherwise they will be deactivated. these plugins are:

Bandwidth you require Piwik <4.0.0-b1
IntranetGeoIP requires Piwik <4.0.0-b1
LoginLdap requires Piwik <4.0.0-b1
SecurityInfo you require Piwik <4.0.0-b1

Does it have something to do with the problems I'm having?

Kind regards

@sgiehl
Copy link
Member

sgiehl commented Mar 10, 2021

@ehermontesinos it might be better if you try to get some help on our forum: http://forum.matomo.org
Besides IntranetGeoIP all other plugins you mentioned should have versions compatible with Matomo 4. Those plugins should be updated automatically as well. But that doesn't have anything to do with the error message you mentioned.

@ehermontesinos
Copy link

I have already posted this same problem on the Matomo forum to see if they give me a solution.
Even at the time I released that sentence manually, I finished modifying the table, but Matamo continued to recognize that the database was not updated correctly, staying on the "Matomo Update" screen.

Best regards and thanks for your time.

@ehermontesinos
Copy link

I have seen this on the Matomo forum

https://forum.matomo.org/t/problem-3-0-3-to-4-1-1-upgrade-i-can-t-get-past-the-database-upgrade-required-page/ 40642/6

What happens to me, and what it does is directly rename those plugins that give you warning. With that it says that the problem was solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants