File: /home/xedaptot/be.naniguide.com/database/migrations/2017_07_24_033211_create_sub_accounts_table.php
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSubAccountsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sub_accounts', function (Blueprint $table) {
$table->increments('id');
$table->uuid('uid');
$table->integer('customer_id')->unsigned();
$table->integer('sending_server_id')->unsigned();
$table->string('username')->nullable();
$table->string('email')->nullable();
$table->string('password')->nullable();
$table->string('api_key_id')->nullable();
$table->string('api_key')->nullable();
$table->timestamps();
// foreign
$table->foreign('customer_id')->references('id')->on('customers')->onDelete('cascade');
$table->foreign('sending_server_id')->references('id')->on('sending_servers')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('sub_accounts');
}
}