44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class CreateSessionsTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('sessions', function (Blueprint $table) {
|
|
$table->uuid('id')->primary();
|
|
$table->boolean('terminated');
|
|
$table->foreignId('user_id')
|
|
->constrained('users')
|
|
->cascadeOnUpdate()
|
|
->cascadeOnDelete();
|
|
$table->foreignId('program_id')
|
|
->constrained('programs')
|
|
->cascadeOnUpdate()
|
|
->cascadeOnDelete();
|
|
$table->timestamp('creation_time')->nullable();
|
|
$table->timestamp('last_ping_time')->nullable();
|
|
$table->ipAddress('ip');
|
|
$table->string('os_username')->nullable();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('sessions');
|
|
}
|
|
}
|