2018-01-13 22:06:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
|
|
|
|
class SetupTableForKeyEncryption extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
2021-01-23 20:33:34 +00:00
|
|
|
*
|
2018-01-13 22:06:19 +00:00
|
|
|
* @throws \Exception
|
|
|
|
* @throws \Throwable
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
Schema::table('api_keys', function (Blueprint $table) {
|
2018-03-03 00:37:39 +00:00
|
|
|
$table->char('identifier', 16)->nullable()->unique()->after('user_id');
|
2018-01-13 22:06:19 +00:00
|
|
|
$table->dropUnique(['token']);
|
|
|
|
});
|
|
|
|
|
|
|
|
Schema::table('api_keys', function (Blueprint $table) {
|
|
|
|
$table->text('token')->change();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
2021-01-23 20:33:34 +00:00
|
|
|
*
|
2018-01-13 22:06:19 +00:00
|
|
|
* @throws \Exception
|
|
|
|
* @throws \Throwable
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
Schema::table('api_keys', function (Blueprint $table) {
|
|
|
|
$table->dropColumn('identifier');
|
|
|
|
$table->string('token', 32)->unique()->change();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|