2021_05_17_141740_create_dictionary_campaigns_table.php 1.52 KB
<?php

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

class CreateDictionaryCampaignsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('dictionary_campaigns', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('external_id')->nullable();
            $table->bigInteger('campaign_id')->unsigned();
            $table->bigInteger('dictionary_id')->unsigned();
            $table->string('name', 255)->nullable();
            $table->text('negative_keywords')->nullable();
            $table->text('excluded_sites')->nullable();
            $table->boolean('synced')->default(1);
            $table->boolean('updated')->default(0);
            $table->timestamp('external_upload_at')->nullable();
            $table->timestamp('external_updated_at')->nullable();
            $table->timestamp('updated_self')->nullable();
            $table->timestamp('updated_children')->nullable();
            $table->timestamps();


            $table->foreign('campaign_id')->references('id')->on('campaigns')
                ->cascadeOnDelete();
            $table->foreign('dictionary_id')->references('id')->on('dictionaries')
                ->cascadeOnDelete();
        });
    }

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