<?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->bigIncrements('id');
            $table->string('name', 256);
            $table->text('description');
            $table->boolean('enabled')->default(true);
            $table->string('featured_img', 256)->default(null)->nullable();
            $table->timestamps();

            $table->bigInteger('agency_id')->default(null);

            // indexes.
            $table->index('agency_id', 'idx_campaigns_agency_id');
        });
    }

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