49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class Vpn extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('vpns', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string("name")->comment("Device Name");
|
|
$table->string("displayName");
|
|
$table->string("listen_port");
|
|
$table->string("network");
|
|
$table->string("private_key");
|
|
$table->string("public_key")->nullable();
|
|
$table->timestamps();
|
|
});
|
|
|
|
Schema::create("vpn_access", function (Blueprint $table) {
|
|
$table->id();
|
|
$table->unsignedBigInteger("user_id");
|
|
$table->unsignedBigInteger("vpn_id");
|
|
$table->enum("status", ["None", "User", "Admin"]);
|
|
$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('vpns');
|
|
Schema::dropIfExists('vpn_access');
|
|
}
|
|
}
|