<?php
/**
 * Migration Class
 *
 * This migration is actually part of the “laravel/sanctum” package. Since Sanctum
 * used to be installed via Jetstream, but Jetstream is no longer used, the Globals
 * package now handles the installation of Sanctum. And to avoid having to run the
 * publish command for Sanctum during project setup, the Globals package generates
 * this file during setup.
 *
 * @version     1.0.$Revision:$
 * @version     SVN: $Id:$
 * @package     bplan-base/globals
 * @subpackage  Migrations
 * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 * @copyright   Copyright (C) 2025, 2026 bplan-solutions GmbH & Co. KG <https://www.bplan-solutions.de/>
 * /Δ\
 */


use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;


/**
 * Migration Class
 *
 * @version     1.0.0 / 2026-04-26
 * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 */
return new class extends Migration
{


    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('personal_access_tokens');

    } // down()


    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('personal_access_tokens', function (Blueprint $Table) {
            $Table->id();

            $Table->timestamp('created_at');
            $Table->timestamp('updated_at');

            $Table->text('abilities')->nullable();
            $Table->timestamp('expires_at')->nullable()->index();
            $Table->timestamp('last_used_at')->nullable();
            $Table->text('name');
            $Table->string('token', 64)->unique();
            $Table->morphs('tokenable');

        });

    } // up()

};
