Create database with utf8 info

This commit is contained in:
Nabeel Shahzad 2018-01-29 16:02:15 -06:00
parent cc40b7580a
commit 23dbbc788f

View File

@ -3,7 +3,6 @@
namespace App\Console\Commands;
use Log;
use PDO;
use App\Console\BaseCommand;
@ -45,15 +44,20 @@ class CreateDatabase extends BaseCommand
}
if ($this->option('reset') === true) {
$sql = "DROP DATABASE IF EXISTS `$name`";
try {
$conn->exec("DROP DATABASE IF EXISTS `$name`");
Log::info('Dropping database: '.$sql);
$conn->exec($sql);
} catch (\PDOException $e) {
Log::error($e);
}
}
$sql = "CREATE DATABASE IF NOT EXISTS `$name` CHARACTER SET UTF8 COLLATE utf8_unicode_ci";
try {
$conn->exec("CREATE DATABASE IF NOT EXISTS `$name`");
Log::info('Creating database: '.$sql);
$conn->exec($sql);
} catch (\PDOException $e) {
Log::error($e);
return false;