您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

2024_11_13_215818_create_payments_table.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. return new class extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. */
  10. public function up(): void
  11. {
  12. Schema::create('payments', function (Blueprint $table) {
  13. $table->id();
  14. $table->foreignId('company_id')->constrained()->cascadeOnDelete();
  15. $table->foreignId('document_id')->constrained()->cascadeOnDelete();
  16. $table->date('date');
  17. $table->integer('amount');
  18. $table->string('payment_method');
  19. $table->foreignId('bank_account_id')->nullable()->constrained()->nullOnDelete();
  20. $table->text('notes')->nullable();
  21. $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
  22. $table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
  23. $table->timestamps();
  24. });
  25. }
  26. /**
  27. * Reverse the migrations.
  28. */
  29. public function down(): void
  30. {
  31. Schema::dropIfExists('payments');
  32. }
  33. };