File: /www/wwwroot/erp.nhatnamsst.com/database/migrations/2025_01_22_000000_create_customers_table.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.
*/
public function up(): void
{
Schema::create('customers', function (Blueprint $table) {
$table->id();
$table->string('code')->unique()->nullable();
$table->string('short_name', 18);
$table->integer('type'); // EU, TM, CN
$table->string('name');
$table->string('contact_person')->nullable();
$table->text('address')->nullable();
$table->string('phone');
$table->string('position')->nullable();
$table->string('tax_code')->nullable();
$table->string('email');
$table->string('payment_method')->nullable();
$table->unsignedBigInteger('sale_id')->nullable();
$table->timestamps();
$table->foreign('sale_id')->references('id')->on('admins')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('customers');
}
};