Matomo Migration error "The following columns are missing in the target DB table"

I’m trying to run the Migration plugin to merge 2 Matomo instances into one.

I have 2 installations of Matomo, both at version: 4.3.1

When I run the command:
php /home/public/stats/matomo/console migration:measurable --source-idsite=3 --target-db-host=DATABASE --target-db-username=USER --target-db-password=PASSWORD --target-db-name="wpmu_stats" --target-db-prefix=matomo_ --dry-run

I get the following error:

The following columns are missing in the target DB table "matomo_log_visit": custom_var_k1, custom_var_v1, custom_var_k2, custom_var_v2, custom_var_k3, custom_var_v3, custom_var_k4, custom_var_v4, custom_var_k5, custom_var_v5
The following columns are missing in the target DB table "matomo_log_link_visit_action": custom_var_k1, custom_var_v1, custom_var_k2, custom_var_v2, custom_var_k3, custom_var_v3, custom_var_k4, custom_var_v4, custom_var_k5, custom_var_v5
The following columns are missing in the target DB table "matomo_log_conversion": custom_var_k1, custom_var_v1, custom_var_k2, custom_var_v2, custom_var_k3, custom_var_v3, custom_var_k4, custom_var_v4, custom_var_k5, custom_var_v5
ERROR [2021-06-09 19:32:58] 97014  Uncaught exception: /home/public/stats/matomo/plugins/Migration/Commands/Migrate.php(84): Please make sure both Matomo instances are on the same version

What am I doing wrong? :frowning: I found a very similar error here, but I’m not sure how to solve the problem.
Any help would be greatly appreciated!

One of the instances seems to have been updated from a pre 4.x version of Matomo, where Custom Variables were still enabled (or they were enabled manually), the other instance doesn’t contain those columns (because the Custom Variables Plugin is not installed / activated).
Easiest way to solve the issue would be to install / activate the Custom Variables Plugin on the new Matomo instance (and to disable the plugin afterwards, because it is deprecated) and then do the import.

1 Like

Thanks for the quick reply!
I guess that means I’ll be moving legacy columns that aren’t ever used… What if I would just delete those columns? I don’t care about them, all I care about is the regular statistics.

First, disable the plugin, then delete the columns carefully in the mentioned tables - make sure, that they don’t contain any data that is important to you.

1 Like

That worked! :partying_face: After I dropped the relevant columns from the relevant tables, the migration succeeded! (with a dry run). Now to do the real thing… :crossed_fingers: