84 lines
2.3 KiB
PHP
84 lines
2.3 KiB
PHP
<?php
|
|
|
|
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('module_vmware', function (Blueprint $table) {
|
|
|
|
$table->id();
|
|
$table->string('name')->nullable();
|
|
|
|
$table->unsignedBigInteger('module_ip_address')->nullable()->index();
|
|
$table->unsignedBigInteger('vcenter_id')->nullable()->index();
|
|
|
|
$table->integer('port')->nullable();
|
|
|
|
$table->unsignedBigInteger('order_id')->nullable()->index();
|
|
|
|
$table->integer('first_payment')->nullable();
|
|
$table->integer('next_payment')->nullable();
|
|
$table->integer('next_due_date')->nullable();
|
|
$table->integer('next_invoice')->nullable();
|
|
|
|
$table->string('user')->nullable();
|
|
$table->text('password')->nullable();
|
|
$table->string('hostname')->nullable();
|
|
$table->string('vmware_id')->nullable();
|
|
|
|
$table->unsignedBigInteger('os_id')->nullable()->index();
|
|
$table->unsignedBigInteger('customer_id')->nullable()->index();
|
|
|
|
$table->tinyInteger('status')
|
|
->default(1)
|
|
->comment('1: Running; 0: Off; 2: Suspend');
|
|
|
|
$table->timestamps();
|
|
|
|
// Foreign Keys
|
|
$table->foreign('module_ip_address')
|
|
->references('id')
|
|
->on('module_ip_address')
|
|
->nullOnDelete();
|
|
|
|
$table->foreign('vcenter_id')
|
|
->references('id')
|
|
->on('module_vcenter')
|
|
->nullOnDelete();
|
|
|
|
$table->foreign('order_id')
|
|
->references('id')
|
|
->on('orders')
|
|
->nullOnDelete();
|
|
|
|
$table->foreign('os_id')
|
|
->references('id')
|
|
->on('os')
|
|
->nullOnDelete();
|
|
|
|
$table->foreign('customer_id')
|
|
->references('id')
|
|
->on('customers')
|
|
->nullOnDelete();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('module_vmware');
|
|
}
|
|
};
|