$dbName = 'ec'.$tenantCreate->id;
$query = sprintf(
"CREATE DATABASE IF NOT EXISTS %s CHARACTER SET %s COLLATE %s;",
$dbName,
$charset,
$collation
);
$result = $connection->statement($query);
if (!$result) {
throw new \Exception('Не создана база данных для аккаунта ' . $tenantCreate->id);
}
$query = sprintf(
"USE %s; SOURCE %s;",
$dbName,
__DIR__ . '/../../../../dump_scheme.sql'
);
$result = $connection->statement($query);
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SOURCE /var/www/app/Tenant/Infrastructure/Services/../../../../dump_sch' at line 1 (SQL: USE ec32; SOURCE /var/www/app/Tenant/Infrastructure/Services/../../../../dump_scheme.sql;)