1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-22 09:02:28 +01:00
Pterodactyl-Panel/database/migrations/2018_01_13_142012_SetupTableForKeyEncryption.php
Lance Pioch 3bf5a71802
PostgreSQL Support (#4486)
Co-authored-by: Matthew Penner <matthew@pterodactyl.io>
2022-11-25 13:29:04 -07:00

41 lines
995 B
PHP

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