2020_01_10_083534_create_entries_table.php 869 Bytes
Newer Older
Jacob Priddy's avatar
Jacob Priddy committed
1
2
3
<?php

use Illuminate\Support\Facades\Schema;
Jacob Priddy's avatar
Jacob Priddy committed
4
5
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
Jacob Priddy's avatar
Jacob Priddy committed
6

7
class CreateEntriesTable extends Migration
Jacob Priddy's avatar
Jacob Priddy committed
8
9
10
11
12
13
{
    /**
     * Run the migrations.
     *
     * @return void
     */
14
    public function up(): void
Jacob Priddy's avatar
Jacob Priddy committed
15
16
    {
        // This table logs all invalid attempts to open a door
17
18
19
        Schema::create('entries', static function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id');
20
            $table->string('door_location');
21
            $table->boolean('success');
22
            $table->foreign('user_id')->references('id')->on('users');
Jacob Priddy's avatar
Jacob Priddy committed
23
24
25
26
27
28
29
30
31
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
32
    public function down(): void
Jacob Priddy's avatar
Jacob Priddy committed
33
    {
34
        Schema::dropIfExists('entries');
Jacob Priddy's avatar
Jacob Priddy committed
35
36
    }
}