I have this software and I need to create new institutions (like kindergardens). How to migrate into that new database?
if ($newDb) {
Config::set('database.connections.th', [
'driver' => 'mysql',
'host' => 'localhost',
'port' => '3306',
'database' => 'kindergarden'.$institutionId,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'timezone' => '+00:00',
'strict' => false,
]);
return \Illuminate\Support\Facades\Artisan::call('migrate');
}
And migrations are like
public function up()
{
Schema::create('students', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('first_name', 100);
$table->string('last_name', 100);
$table->tinyInteger('gender');
$table->date('date_of_birth');
$table->string('address', 150);
$table->string('phone_number', 20);
$table->string('email', 100);
$table->unsignedTinyInteger('status')->default(1);
$table->timestamps();
$table->softDeletes();
});
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire