<?php

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

class CreateTextLinksHistoryTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('link_histories', function (Blueprint $table) {
            $table->id();
            $table->string('key');
            $table->integer('total')->default(0);
            $table->timestamps();
        });

        Schema::create('link_history_details', function (Blueprint $table) {
            $table->id();
            $table->integer('link_history_id');
            $table->integer('article_id');
            $table->string('title')->nullable();
            $table->longText('content')->nullable();
            $table->integer('total')->default(0);
            $table->smallInteger('status')->default(0);
            $table->timestamps();
        });
    }

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