"SQLSTATE[42S02]: Base table or view not found: 1146 Table '[DBNAME].piwik_plugin_setting' doesn't exist"
After automatic upgrade to v3 I receive the above error, I do not know from which version I upgraded.
You may be able to fix this error by executing the following SQL query:
CREATE TABLE piwik_plugin_setting (
`plugin_name` VARCHAR(60) NOT NULL,
`setting_name` VARCHAR(255) NOT NULL,
`setting_value` LONGTEXT NOT NULL,
`user_login` VARCHAR(100) NOT NULL DEFAULT '',
INDEX(plugin_name, user_login)
) ENGINE=InnoDb DEFAULT CHARSET=utf8
It should have created this table automatically during the update. Was there maybe any error shown?
I have seen the same error coming from an ancient version 2.8.3 but no previous error
Same error upgrading from 2.13.1 to 3.0.1.
Same error here. After running the above SQL query, the error changed to
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database_name.piwik_site_setting' doesn't exist
No errors were shown prior to the database update step. It does seem to mention file issues, but when I tried to resolve those the setup broke, so I'm doing a manual update now.
+1 upgrading from 2.14.2
Looks like it blew up after 2.15.0-b12 (if that's any help)
I believe this is simple... the upgrade 2.15.0-b16 rerences $pluginManager:
public function doUpdate(Updater $updater)
{
$this->uninstallPlugin('LeftMenu');
$this->uninstallPlugin('ZenMode');
}
private function uninstallPlugin($plugin)
{
$pluginManager = Manager::getInstance();
if ($pluginManager->isPluginInstalled($plugin)) {
if ($pluginManager->isPluginActivated($plugin)) {
$pluginManager->deactivatePlugin($plugin);
}
$pluginManager->unloadPlugin($plugin);
$pluginManager->uninstallPlugin($plugin);
} else {
$this->makeSurePluginIsRemovedFromFilesystem($plugin);
}
}
When the 3.x codebase attempts to run this command, it tries to use the 3.x table. Obviously, the appropriate tables (let alone entries) don't exist yet.
The "fix" is to upgrade to a late 2.x version before going to 3.x. Even 2.16.3-b2 calls activatePlugin on \Piwik\Plugin\Manager so it may be necessary to go all the way to 2.16.5 before jumping to 3.x.
When the 3.x codebase attempts to run this command, it tries to use the 3.x table. Obviously, the appropriate tables (let alone entries) don't exist yet.
OK we will need to investigate this and make sure 100% that the upgrade from 2.0 to 3.0 should work.
Here's what I did:
I immediately was prompted with the error:
Critical Error during the update process:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'piwik_test.piwik_plugin_setting' doesn't exist
I also provided a diagnosis and proposed solution in #11552 (now closed)
Thank you very much for the steps to reproduce. I can also reproduce it now :+1: we'll investigate in the next few weeks for sure
I've still had this happen when trying to upgrade from 2.4.0 to 3.2.1 by replacing the files and then accessing the index which triggers the updater.
First I got:
Mysqli prepare error: Table 'database.piwik_plugin_setting' doesn't exist
As suggested I created it manually. Then I got the same error message about piwik_plugin_setting which I then also created manually. It then stopped with
Mysqli prepare error: Unknown column 'plugin_name' in 'where clause'
The workaround from this forum post that worked was to reset the database, then upgrade to 2.17.0 and finally upgrade to 3.2.1.
Most helpful comment
You may be able to fix this error by executing the following SQL query:
It should have created this table automatically during the update. Was there maybe any error shown?