0

I am trying to install Magento 2 using a Digital Ocean Managed Database(DO). The issue is that DO does not allow tables to be created without a primary key(via global sql_require_primary_key=1). They do allow this to be set locally via SET @@local.sql_require_primary_key = 0;, but I cannot think of a way to set this before any/all CREATE TABLE ... run during each and every setup. I was able to install Magento via a SQL import and setting the session variable, but now even extensions that create tables are erroring out. Any ideas?

1 Answer 1

0

Come to find out the /app/etc/env.php file has an initStatements setting where these can be set. My specific need was added like so

'db' => [
    'connection' => [
        'default' => [
            'initStatements' => 'SET NAMES utf8; SET @@local.sql_require_primary_key = OFF;'
        ]
    ]
]

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.