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

37 lines
868 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePermissionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('permissions', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('user_id');
$table->unsignedInteger('program_id');
$table->timestamp('expiration_time')->nullable();
$table->unsignedInteger('max_session_count')->default(1);
$table->unique(['user_id', 'program_id'], 'user_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('permissions');
}
}