Files
pterodactyl-panel/database/migrations/old/2018_01_13_142012_SetupTableForKeyEncryption.php
T

43 lines
1.0 KiB
PHP
Raw Normal View History

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