Migration overwrite $connection property don't work #31060
Closed
Description
- Laravel Version: 6.10.0
- PHP Version: 7.2.18
- Database Driver & Version: Mysql - 5.7
Description:
I overwrite $connection property in migration, but still migrate on the default database connection
as its described on the "abstract class Migration"
abstract class Migration
{
/**
* The name of the database connection to use.
*
* @var string|null
*/
protected $connection;
The migration file i used
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProjectsTable extends Migration
{
protected $connection = 'pgsql';
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('projects', function (Blueprint $table) {
$table->bigIncrements('id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('projects');
}
}
Note: the default connection i use on .env is mysql
Metadata
Assignees
Labels
No labels