matomo-org / plugin-Migration

Migrate a Matomo Measurable (website, app, roll-up, ...) from one Matomo instance to another Matomo
5 stars 11 forks source link

WP DB Error: [1146] Table 'DBNAME.site' doesn't exist SQL: SHOW COLUMNS FROM site #29

Open dudzislaw opened 4 years ago

dudzislaw commented 4 years ago

I want to migrate from Matomo instance for WordPress to my own Matomo installation. The following error occurs:

php71-cli wp-content/plugins/matomo/app/console migration:measurable --source-idsite=1 --target-db-host=HOST --target-db-username=USERNAME --target-db-password=PASSWORD --target-db-name=DBNAME
Are you sure you want to migrate the data for idSite 1. (y/N)y
Matomo: Uncaught exception: /wp-content/plugins/matomo/classes/WpMatomo/Db/WordPress.php(404): WP DB Error: [1146] Table 'DBNAME.site' doesn't exist SQL: SHOW COLUMNS FROM site
WP DB Error: [1146] Table 'DBNAME.site' doesn't exist SQL: SHOW COLUMNS FROM site
#0 /wp-content/plugins/matomo/classes/WpMatomo/Db/WordPress.php(416): Piwik\Db\Adapter\WordPress->after_execute_query(Object(wpdb), 'SHOW COLUMNS FR...')
#1 /wp-content/plugins/Migration/TargetDb.php(88): Piwik\Db\Adapter\WordPress->fetchAll('SHOW COLUMNS FR...')
#2 /wp-content/plugins/Migration/Migrations/BaseMigration.php(56): Piwik\Plugins\Migration\TargetDb->getTableColumns('site')
#3 /wp-content/plugins/Migration/Migrations/SiteMigration.php(21): Piwik\Plugins\Migration\Migrations\BaseMigration->checkTablesHaveSameStructure(Object(Piwik\Plugins\Migration\TargetDb), 'site')
#4 /wp-content/plugins/Migration/Commands/Migrate.php(76): Piwik\Plugins\Migration\Migrations\SiteMigration->validateStructure(Object(Piwik\Plugins\Migration\TargetDb))
#5 /wp-content/plugins/matomo/app/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Piwik\Plugins\Migration\Commands\Migrate->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /wp-content/plugins/matomo/app/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /wp-content/plugins/matomo/app/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plugins\Migration\Commands\Migrate), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 [internal function]: Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /wp-content/plugins/matomo/app/core/Console.php(140): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /wp-content/plugins/matomo/app/core/Access.php(644): Piwik\Console->Piwik\{closure}()
#11 /wp-content/plugins/matomo/app/core/Console.php(141): Piwik\Access::doAsSuperUser(Object(Closure))
#12 /wp-content/plugins/matomo/app/core/Console.php(93): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /wp-content/plugins/matomo/app/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /wp-content/plugins/matomo/app/console(32): Symfony\Component\Console\Application->run()
#15 {main}

[Zend_Db_Statement_Exception]
WP DB Error: [1146] Table 'DBNAME.site' doesn't exist SQL: SHOW COLUMNS FROM site

I see the problem in tablenames. It should be "DBNAME.WordPress-prefix_matomo_site" (there is such table in DB), but there is just: DBNAME.site.

I wonder if you could help me with this strange bug(?).

tsteur commented 4 years ago

@dudzislaw you likely need to set the parameter --target-db-prefix=matomo_ for example. It's probably about the target DB where it fails and not the source.