2021_05_11_084828_create_campaigns_table.php 2.05 KB
<?php

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

class CreateCampaignsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('campaigns', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('token')->unsigned();
            $table->bigInteger('external_id')->unique();
            $table->string('name', 255)->nullable();
            $table->json('time_targeting')->nullable();
            $table->text('negative_keywords')->nullable();
            $table->text('blocked_ips')->nullable();
            $table->text('excluded_sites')->nullable();
            $table->json('daily_budget')->nullable();
            $table->string('text_campaign_strategy_search')->nullable();
            $table->string('text_campaign_strategy_network')->nullable();
            $table->json('settings')->nullable();
            $table->text('counter_ids')->nullable();
            $table->integer('relevant_keywords_setting_budget_percent')->nullable();
            $table->bigInteger('relevant_keywords_setting_optimize_goal_id')->nullable();
            $table->string('attribution_model', 4)->nullable();
            $table->json('priority_goals')->nullable();
            $table->enum('updated', [
                \App\Service\Requests\Direct\CheckCampaignsChange::CHILDREN,
                \App\Service\Requests\Direct\CheckCampaignsChange::SELF,
                \App\Service\Requests\Direct\CheckCampaignsChange::STAT,
            ])->nullable();
            $table->boolean('manage')->default(0);
            $table->boolean('enabled')->default(1);
            $table->timestamp('groups_loaded_at')->nullable();
            $table->timestamps();

            $table->foreign('token')->references('id')->on('tokens');
        });
    }

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