33 lines
1.2 KiB
PHP
33 lines
1.2 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration {
|
|
public function up(): void {
|
|
Schema::create('offtakers', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('user_email')->unique();
|
|
$table->string('company_name');
|
|
$table->string('contact_name')->nullable();
|
|
$table->string('phone')->nullable();
|
|
$table->text('address')->nullable();
|
|
$table->boolean('is_active')->default(true);
|
|
$table->string('sync_status')->default('pending');
|
|
|
|
// Audit Columns
|
|
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
|
|
|
|
$table->timestamp('created_date')->useCurrent();
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
});
|
|
}
|
|
|
|
public function down(): void {
|
|
Schema::dropIfExists('offtakers');
|
|
}
|
|
}; |