File: //home/xedaptot/ai.naniguide.com/database/migrations/2016_06_16_034310_create_campaigns_table.php
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
class CreateCampaignsTable extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
if (Schema::hasTable('campaigns')) {
return;
}
Schema::create('campaigns', function (Blueprint $table) {
$table->increments('id');
$table->uuid('uid');
$table->integer('customer_id')->unsigned();
$table->integer('mail_list_id')->unsigned()->nullable();
$table->integer('segment_id')->unsigned()->nullable();
$table->integer('default_mail_list_id')->unsigned()->nullable();
$table->integer('template_id')->unsigned()->nullable();
$table->bigInteger('tracking_domain_id')->unsigned()->nullable();
$table->bigInteger('signature_id')->unsigned()->nullable();
$table->integer('running_pid')->nullable();
$table->text('type');
$table->text('name');
$table->text('subject')->nullable();
$table->longtext('plain')->nullable();
$table->text('from_email')->nullable();
$table->text('from_name')->nullable();
$table->text('reply_to')->nullable();
$table->text('status')->nullable();
$table->boolean('sign_dkim')->nullable();
$table->boolean('track_open')->nullable();
$table->boolean('track_click')->nullable();
$table->longText('last_error')->nullable();
$table->boolean('use_default_sending_server_from_email')->default(false);
$table->boolean('skip_failed_message')->default(false);
$table->text('preheader')->nullable();
$table->text('delivery_statuses')->nullable();
$table->timestamp('run_at')->nullable();
$table->timestamp('delivery_at')->nullable();
$table->timestamps();
$table->foreign('customer_id')->references('id')->on('customers')->onDelete('cascade');
$table->foreign('mail_list_id')->references('id')->on('mail_lists')->onDelete('cascade');
$table->foreign('default_mail_list_id')->references('id')->on('mail_lists')->onDelete('cascade');
$table->foreign('template_id')->references('id')->on('templates')->onDelete('set null');
$table->foreign('segment_id')->references('id')->on('segments');
$table->foreign('tracking_domain_id')->references('id')->on('tracking_domains');
$table->foreign('signature_id')->references('id')->on('signatures')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::drop('campaigns');
}
}