0

in my database I saw tables which start on m2_cl. I deleted them, but my project stopped working, so I brought them back to life.

if i delete table m2_cl_log_visitor i have this error

Base table or view not found: 1146 Table 'dd.m2_cl_log_visitor' doesn't exist, query was: INSERT INTO `log_visitor` (`session_id`, `first_visit_at`, `last_visit_at`, `last_url_id`, `store_id`) VALUES (?, ?, ?, ?, ?)

How do I delete these tables correctly? They are not needed, but take up a lot of space

and why, after removing them, the site does not work?

2 Answers 2

0

Magento expects these tables to be present, thus they can not be removed. You can clean them, however, truncating all contents.

If you have cronjobs running this can be done via System > Configuration > Advanced > System > Log Cleaning. Choose a number of days to keep the logs, turn on "Enable Log Cleaning" and set the frequency to daily.

2
  • but what is the use of these tables? Commented Jan 14, 2020 at 15:27
  • @DenysMaksiura they are used for reports mostly. Keeping track of a users views pages. Commented Jan 15, 2020 at 7:45
0

Yes, you can do it, but FIRST you will need to delete/drop the trigger events that were inserted by UB Data Migration Tool or any migration tool that uses the same technique.

I will give a short answer, but I wrote a tutorial that needs a bit of improvement, but I guess you can follow it.

Short explanation that causes the errors

UB Data Migration Tool when migrating duplicate tables they need to migrate from M1 to M2 and identify these tables as "m2_"

When creating them, they insert a trigger into the original table, and put a sufix and prefix on it. IE "cataloginventory_stock_item" has 3 triggers associated with it. 1: "trg_cataloginventory_stock_item_after_delete", 2 "trg_cataloginventory_stock_item_after_insert" and 3 "trg_cataloginventory_stock_item_after_update"

The same process follows to all tables affected

So, basically, BEFORE deleting "m2_" tables, you need to DROP/DELETE these triggers from the original tables.

Here is a more explained tutorial I did for it bit.ly / 3sYl1hr (I had to put it separated but just put it together in your browser)

IMPORTANT Make a FULL BACKUP of your DATABASE and FULLY TEST it in a DEV website before applying it to a production website.

I hope that helps someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.