I want to create several schemas to my database using migration. I have this code:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSchemaAdministracion extends Migration
{
public function up()
{
DB::unprepared("CREATE SCHEMA `administracion`");
}
public function down()
{
DB::unprepared('DROP SCHEMA `administracion`');
}
}
I tried this way but I got: Invalid schema name: 7 ERROR: No schema has been selected
.
DB::getConnection()->statement('CREATE DATABASE :schema', ['schema' => 'administracion']);
maybe?