Files
pterodactyl-panel/database/migrations/old/2018_01_13_142012_SetupTableForKeyEncryption.php
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

43 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class SetupTableForKeyEncryption extends Migration
{
/**
* Run the migrations.
*
* @throws Exception
* @throws Throwable
*/
public function up(): void
{
Schema::table('api_keys', function (Blueprint $table): void {
$table->char('identifier', 16)->nullable()->unique()->after('user_id');
$table->dropUnique(['token']);
});
Schema::table('api_keys', function (Blueprint $table): void {
$table->text('token')->change();
});
}
/**
* Reverse the migrations.
*
* @throws Exception
* @throws Throwable
*/
public function down(): void
{
Schema::table('api_keys', function (Blueprint $table): void {
$table->dropColumn('identifier');
$table->string('token', 32)->unique()->change();
});
}
}