2021_07_07_090108_create_goal_sitelinks_table.php 1.26 KB
<?php

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

class CreateGoalSitelinksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goal_sitelinks', function (Blueprint $table) {
            $table->id();

            $table->bigInteger('external_id')->nullable();
            $table->bigInteger('sitelink_id')->unsigned();
            $table->bigInteger('token_id')->unsigned();
            $table->timestamp('external_upload_at')->nullable();
            $table->timestamp('external_updated_at')->nullable();
            $table->timestamp('updated_need')->nullable();
            $table->timestamp('reserve_create_at')->nullable();

            $table->foreign('sitelink_id')->references('id')->on('sitelinks')
                ->cascadeOnDelete();
            $table->foreign('token_id')->references('id')->on('tokens')
                ->cascadeOnDelete();

            $table->softDeletes();
            $table->timestamps();
        });
    }

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