2020_02_18_071123_create_user_tokens_table.php 896 Bytes
Newer Older
Jacob Priddy's avatar
Jacob Priddy committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserTokensTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_tokens', static function (Blueprint $table) {
            $table->bigIncrements('id');
Jacob Priddy's avatar
Jacob Priddy committed
18
            $table->string('name')->nullable()->default(null);
Jacob Priddy's avatar
Jacob Priddy committed
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
            $table->string('api_token');
            $table->unsignedBigInteger('user_id');
            $table->timestamp('expires_at')->nullable();
            $table->foreign('user_id')->references('id')->on('users');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_tokens');
    }
}