mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +00:00
Add load balancer (#453)
This commit is contained in:
25
database/factories/LoadBalancerServerFactory.php
Normal file
25
database/factories/LoadBalancerServerFactory.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\LoadBalancerServer;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class LoadBalancerServerFactory extends Factory
|
||||
{
|
||||
protected $model = LoadBalancerServer::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'load_balancer_id' => $this->faker->randomNumber(), //
|
||||
'ip' => $this->faker->ipv4(),
|
||||
'port' => $this->faker->randomNumber(),
|
||||
'weight' => $this->faker->randomNumber(),
|
||||
'backup' => $this->faker->boolean(),
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
];
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('load_balancer_servers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('load_balancer_id');
|
||||
$table->string('ip');
|
||||
$table->integer('port');
|
||||
$table->integer('weight')->nullable();
|
||||
$table->boolean('backup');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('load_balancer_servers');
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user