software-admin-panel-laravel/database/migrations/2022_11_17_002411_create_se...

44 lines
1.1 KiB
PHP
Raw Normal View History

2022-11-16 20:07:10 -06:00
<?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');
}
}