1
I need to turn the remote php artisan migrate
and each Migration go to your respective database, I have the following code on .env
:
DB_CONNECTION=mysql
DB_HOST=163.25.138.18
DB_PORT=3306
DB_DATABASE=book_posts
DB_USERNAME=teste
DB_PASSWORD=teste1
DB_BOOKLOGIN_CONNECTION=mysql
DB_BOOKLOGIN_HOST=163.25.138.18
DB_BOOKLOGIN_PORT=3306
DB_BOOKLOGIN_DATABASE=book_usuarios
DB_BOOKLOGIN_USERNAME=teste
DB_BOOKLOGIN_PASSWORD=teste1
DB_BOOKMATERIAIS_CONNECTION=mysql
DB_BOOKMATERIAIS_HOST=163.25.138.18
DB_BOOKMATERIAIS_PORT=3306
DB_BOOKMATERIAIS_DATABASE=book_materiais
DB_BOOKMATERIAIS_USERNAME=teste
DB_BOOKMATERIAIS_PASSWORD=teste1
I used the variable $connection
in Migrations thus:
protected $connection = 'bookmateriais';
public function up()
{
Schema::create('locais', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('nome');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('locals');
}
But when I spin php artisan migrate
goes to the default bank, someone knows how to direct the Migration to their respective databases?