Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

2024_11_13_214149_create_offerings_table.php 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738
  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('offerings', function (Blueprint $table) {
  13. $table->id();
  14. $table->foreignId('company_id')->constrained()->cascadeOnDelete();
  15. $table->string('name')->index();
  16. $table->string('description')->nullable();
  17. $table->string('type')->nullable(); // product, service, etc.
  18. $table->integer('price')->default(0);
  19. $table->boolean('sellable')->default(false);
  20. $table->boolean('purchasable')->default(false);
  21. $table->foreignId('income_account_id')->nullable()->constrained('accounts')->nullOnDelete(); // income account e.g. sales/invoice
  22. $table->foreignId('expense_account_id')->nullable()->constrained('accounts')->nullOnDelete(); // expense account e.g. purchase/bill
  23. $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
  24. $table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
  25. $table->timestamps();
  26. });
  27. }
  28. /**
  29. * Reverse the migrations.
  30. */
  31. public function down(): void
  32. {
  33. Schema::dropIfExists('offerings');
  34. }
  35. };