Files
panel/database/migrations/2018_01_13_142012_SetupTableForKeyEncryption.php

43 lines
994 B
PHP
Raw Normal View History

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
2024-03-19 21:03:50 -04:00
return new class extends Migration
{
/**
* Run the migrations.
*
2021-01-23 12:33:34 -08:00
*
* @throws \Exception
* @throws \Throwable
*/
2024-03-19 21:12:27 -04:00
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.
*
2021-01-23 12:33:34 -08:00
*
* @throws \Exception
* @throws \Throwable
*/
2024-03-19 21:12:27 -04:00
public function down(): void
{
Schema::table('api_keys', function (Blueprint $table) {
$table->dropColumn('identifier');
$table->string('token', 32)->unique()->change();
});
}
2024-03-19 21:03:50 -04:00
};