2021-02-09 18:00:04 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
|
|
|
|
class Server extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
Schema::create("servers", function (Blueprint $table) {
|
|
|
|
$table->id();
|
|
|
|
$table->timestamps();
|
2021-02-09 21:11:32 +00:00
|
|
|
$table->string("servername")->unique();
|
2021-02-09 18:00:04 +00:00
|
|
|
$table->timestamp("last_seen")->nullable();
|
|
|
|
$table->bigInteger("storage")->comment("In Byte, for cache");
|
|
|
|
$table->bigInteger("userd")->comment("Userd Space in Byte")->nullable();
|
2021-02-09 21:11:32 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
Schema::table("images", function (Blueprint $table) {
|
|
|
|
$table->string("servername")->nullable();
|
|
|
|
$table->foreign('servername')->references('servername')->on('servers');
|
2021-02-09 18:00:04 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
Schema::dropIfExists("servers");
|
2021-02-09 21:11:32 +00:00
|
|
|
/*Schema::table("images", function (Blueprint $table) {
|
|
|
|
$table->dropConstrainedForeignId("servername");
|
|
|
|
$table->dropColumn("servername");
|
|
|
|
});*/
|
2021-02-09 18:00:04 +00:00
|
|
|
}
|
|
|
|
}
|