<?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('invoice_billings', function (Blueprint $t) { $t->id(); $t->string('name', 255); $t->string('display_name', 255); $t->enum('type', ['e-invoice','e-archive'])->default('e-invoice'); $t->boolean('is_active')->default(1); $t->boolean('is_automatic')->default(0); $t->json('settings')->nullable(); $t->json('mapping_fields')->nullable(); $t->enum('status', ['active','inactive','error'])->default('active'); $t->text('last_error')->nullable(); $t->timestamp('last_sync_at')->nullable(); $t->timestamp('created_at')->nullable(); $t->timestamp('updated_at')->nullable(); $t->index(['is_active', 'is_automatic'], 'invoice_billings_is_active_is_automatic_index'); $t->unique('name', 'invoice_billings_name_unique'); $t->index(['type', 'status'], 'invoice_billings_type_status_index'); }); } public function down(): void { Schema::dropIfExists('invoice_billings'); } }; 