vpn.keks.cloud/database/migrations/2020_11_07_234319_peers.php

44 lines
1.1 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Peers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('peers', function (Blueprint $table) {
$table->id();
$table->string("name");
$table->string("public_key");
$table->string("ip")->nullable();
$table->string("allowed_ips")->nullable();
$table->string("preshared_key")->nullable();
$table->boolean("imported")->default(false);
$table->unsignedBigInteger("user_id")->nullable();
$table->unsignedBigInteger("vpn_id");
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users');
$table->foreign('vpn_id')->references('id')->on('vpns');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('peers');
}
}