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?
Add a comment
|
1 Answer
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;'
]
]
]