File: //home/xedaptot/ai.naniguide.com/database/migrations/2016_06_19_145434_create_click_logs_table.php
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateClickLogsTable extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::create('click_logs', function (Blueprint $table) {
$table->increments('id');
$table->string('message_id');
$table->integer('customer_id')->unsigned()->nullable();
$table->integer('tracking_log_id')->unsigned()->nullable();
$table->text('url');
$table->string('ip_address')->nullable();
$table->text('user_agent')->nullable();
$table->timestamps();
// foreign
$table->foreign('message_id')->references('message_id')->on('tracking_logs')->onDelete('cascade');
$table->foreign('customer_id')->references('id')->on('customers')->onDelete('cascade');
$table->foreign('tracking_log_id')->references('id')->on('tracking_logs')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::drop('click_logs');
}
}