123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?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('documents', function (Blueprint $table) {
- $table->id();
- $table->foreignId('company_id')->constrained()->cascadeOnDelete();
- $table->foreignId('document_default_id')->nullable()->constrained()->nullOnDelete();
- $table->string('type');
- $table->string('document_number');
- $table->string('order_number')->nullable();
- $table->string('status');
- $table->dateTime('document_date');
- $table->dateTime('due_date');
- $table->dateTime('paid_date')->nullable();
- $table->double('amount', 15, 4);
- $table->foreignId('tax_id')->nullable()->constrained()->nullOnDelete();
- $table->foreignId('discount_id')->nullable()->constrained()->nullOnDelete();
- $table->string('reference')->nullable();
- $table->string('currency_code')->nullable();
- $table->foreignId('category_id')->nullable()->constrained()->nullOnDelete();
- $table->foreignId('contact_id')->nullable()->constrained()->nullOnDelete();
- $table->text('notes')->nullable();
- $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
- $table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
- $table->timestamps();
-
- $table->foreign('currency_code')->references('code')->on('currencies')->nullOnDelete();
- });
- }
-
- /**
- * Reverse the migrations.
- */
- public function down(): void
- {
- Schema::dropIfExists('documents');
- }
- };
|