add missing api_token columns to database (table users and admins)

This commit is contained in:
David Große 2020-01-02 15:45:25 +01:00
parent 1b026bc913
commit be05a8aae9
1 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,52 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddApiTokenColumns extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// @see https://laravel.com/docs/6.x/api-authentication#database-preparation
Schema::table('users', function ($table) {
$table
->string('api_token', 80)
->after('password')
->unique()
->nullable()
->default(null);
});
Schema::table('admins', function ($table) {
$table
->string('api_token', 80)
->after('password')
->unique()
->nullable()
->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('api_token');
});
Schema::table('admins', function (Blueprint $table) {
$table->dropColumn('api_token');
});
}
}