73 lines
2.5 KiB
PHP
73 lines
2.5 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration {
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
//
|
|
Schema::create('customers', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->uuid('uuid')->unique();
|
|
$table->string('fullname', 100)->nullable();
|
|
$table->string('avatar', 100)->nullable();
|
|
$table->integer('gender')->default(0);
|
|
$table->string('address', 100)->nullable();
|
|
$table->string('state', 100)->nullable();
|
|
$table->string('city', 100)->nullable();
|
|
$table->integer('postcode')->nullable();
|
|
$table->string('country', 100)->nullable();
|
|
$table->string('company', 100)->nullable();
|
|
$table->string('phone', 100)->unique()->nullable();
|
|
$table->string('email', 100)->unique()->nullable();
|
|
$table->string('email_verify', 100)->nullable();
|
|
$table->string('email_hash', 100)->nullable();
|
|
$table->tinyInteger('email_marketing')->default(1);
|
|
$table->tinyInteger('receive_deposit')->default(1);
|
|
$table->string('password')->nullable();
|
|
$table->integer('credit')->default(0);
|
|
$table->integer('total')->default(0);
|
|
$table->string('identity_number')->nullable();
|
|
$table->string('front_identity_number')->nullable();
|
|
$table->string('back_identity_number')->nullable();
|
|
$table->string('province_code', 20)->nullable();
|
|
$table->string('ward_code', 20)->nullable();
|
|
$table->string('remember_token', 100)->nullable();
|
|
$table->tinyInteger('status')->default(1);
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
|
|
$table->foreign('province_code')
|
|
->references('code')
|
|
->on('provinces')
|
|
->onDelete('set null');
|
|
|
|
$table->foreign('ward_code')
|
|
->references('code')
|
|
->on('wards')
|
|
->onDelete('set null');
|
|
|
|
$table->index('province_code', 'idx_users_province');
|
|
$table->index('ward_code', 'idx_users_ward');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
//
|
|
Schema::dropIfExists('customers');
|
|
}
|
|
};
|