Lae/database/migrations/2022_08_13_051148_create_hosts_table.php

57 lines
1.2 KiB
PHP
Raw Normal View History

2022-08-13 06:04:47 +00:00
<?php
use App\Models\Module\ProviderModule;
use App\Models\User;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('hosts', function (Blueprint $table) {
$table->id();
// name
$table->string('name')->index();
// provider id
$table->foreignIdFor(ProviderModule::class)->index();
// user_id
$table->foreignIdFor(User::class)->index();
// price
2022-08-13 09:47:10 +00:00
$table->double('price', 60, 8)->index();
2022-08-13 06:04:47 +00:00
// config
$table->json('configuration')->nullable();
// status
$table->enum('status', ['running', 'stopped', 'error', 'suspended', 'pending'])->default('pending')->index();
// soft delete
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('hosts');
}
};