0

I'm using Magento 2.2.7, I had a prefix on my tables, e.g: ab_, I've removed the prefix on all my database tables via phpmyadmin, and I'm unable to now create orders due to the following error:

[2019-02-26 11:52:17] main.CRITICAL: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'site_db.ab_sequence_order_1' doesn't exist, query was: INSERT INTO `ab_sequence_order_1` () VALUES () {"exception":"[object] (Zend_Db_Statement_Exception(code: 42): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'site_db.ab_sequence_order_1' doesn't exist, query was: INSERT INTO `ab_sequence_order_1` () VALUES () at /Applications/MAMP/htdocs/MY-SITE/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235, PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'site_db.ab_sequence_order_1' doesn't exist at /Applications/MAMP/htdocs/MY-SITE/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228)"} []

Any suggestions?

0

Did you removed the table_prefix from app/etc/env.php? Below is reference code:

    'db' => [
        'table_prefix' => '',
        'connection' => [
            'default' => [
                'host' => 'localhost',
                'dbname' => 'db_name',
                'username' => 'root',
                'password' => '123',
                'active' => '1'
            ]
        ]
    ],
| improve this answer | |
  • Yes, I removed it from there, the homepage, backend, catalog and product views all load fine, the cart loads, and the checkout loads, but when I click on the actual checkout button at the very end of the process it complains about the site_db.ab_sequence_order_1 being missing, I'm not sure why when generating an order it would still be looking for a prefixed table? It should be worth noting, that I had existing orders in the system before removing the prefix. – Ryan Holton Feb 26 '19 at 14:01
  • I also get a Unique constraint violation found when running the bin/magento setup:upgrade command after renaming the database – Ryan Holton Feb 26 '19 at 14:46
0

Looks like it was caused by the sales_sequence_meta table requiring to be updated as values inside this table contained prefixed values.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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