Migrations fixed for customers

This commit is contained in:
prashant-webkul 2018-07-27 15:38:04 +05:30
parent 1358a6a27d
commit f119f95ed7
3 changed files with 10 additions and 36 deletions

View File

@ -17,12 +17,15 @@ class CreateCustomersTable extends Migration
$table->increments('id');
$table->string('first_name');
$table->string('last_name');
$table->string('email');
$table->enum('gender', ['Male', 'Female']);
$table->date('date_of_birth');
$table->string('phone')->unique()->nullable();
$table->string('email')->unique();
$table->string('password');
$table->integer('customer_group_id')->unsigned()->nullable();
$table->integer('address_id')->unsigned()->nullable();
$table->foreign('customer_group_id')->references('id')->on('customer_groups')->onDelete('cascade');
$table->foreign('address_id')->references('id')->on('customer_addresses')->onDelete('cascade');
$table->boolean('subscribed_to_news_letter')->default(0);
$table->rememberToken();
$table->timestamps();
});
}

View File

@ -15,13 +15,14 @@ class CreateCustomerAddressesTable extends Migration
{
Schema::create('customer_addresses', function (Blueprint $table) {
$table->increments('id');
$table->string('street');
$table->integer('customer_id')->unsigned();
$table->foreign('customer_id')->references('id')->on('customers');
$table->string('address1');
$table->string('address2');
$table->string('address2')->nullable();
$table->string('country');
$table->string('state');
$table->string('city');
$table->integer('pincode');
$table->integer('postcode');
$table->timestamps();
});
}

View File

@ -1,30 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddRememberTokenInCustomersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('customers', function (Blueprint $table) {
$table->rememberToken();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}