I'm creating a laravel project that requires multiple databases.These databases are to be populated using laravel migrations.
However, these migrations are to have tables that are the same name on different databases, for eg:
table1.users
table2.users
The code I am using is as follows:
public function up()
{
// Core table
Schema::connection('database1')->create('users', function (Blueprint $table) {
$table->bigIncrements('id');
// ...
});
// table2
Schema::connection('database2')->create('users', function (Blueprint $table) {
$table->bigIncrements('id');
//...
});
}
Laravel stores migrations without any form of connection info/namespacing, meaning that a duplicate error is produced and the migration fails.
Does anyone know of a way of either aliasing or namespacing the table entries?
Thanks in advance