<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Sakura\DB;

class StatusTables extends Migration
{
    /**
     * Run the migrations.
     * @return void
     */
    public function up()
    {
        $schema = DB::getSchemaBuilder();

        $schema->create('status_history', function (Blueprint $table) {
            $table->string('history_name');
            $table->smallInteger('history_port')->unsigned();
            $table->string('history_protocol');
            $table->tinyInteger('history_state')->unsigned();
            $table->timestamp('history_date')->useCurrent = true;
        });

        $schema->create('status_events', function (Blueprint $table) {
            $table->increments('event_id');
            $table->timestamp('event_date')->useCurrent = true;
            $table->tinyInteger('event_state')->unsigned();
            $table->string('event_text');
        });
    }

    /**
     * Reverse the migrations.
     * @return void
     */
    public function down()
    {
        $schema = DB::getSchemaBuilder();

        $schema->drop('status_history');
        $schema->drop('status_events');
    }
}