2025_03_24_153700_create_orders_table.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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('orders', function (Blueprint $table) {
  13. $table->id();
  14. $table->foreignId('user_id')->constrained('users')->restrictOnDelete(); // менеджер
  15. $table->foreignId('district_id')->constrained('districts')->restrictOnDelete(); // округ
  16. $table->foreignId('area_id')->constrained('areas')->restrictOnDelete(); // район
  17. $table->string('object_address'); // адрес объекта
  18. $table->foreignId('object_type_id')->constrained('object_types')->restrictOnDelete(); // тип объекта
  19. $table->date('contract_date')->nullable(); // дата договора
  20. $table->string('contract_number')->nullable(); // номер дог-ра
  21. $table->text('comment')->nullable(); // комментарий
  22. $table->date('installation_date')->nullable(); // дата монтажа
  23. $table->foreignId('brigadier_id')->constrained('users')->restrictOnDelete(); // бригадир
  24. $table->foreignId('order_status_id')->constrained('order_statuses')->restrictOnDelete(); // статус объекта
  25. $table->string('tg_group_name')->nullable();
  26. $table->string('tg_group_link')->nullable();
  27. $table->timestamps();
  28. $table->softDeletes();
  29. });
  30. }
  31. /**
  32. * Reverse the migrations.
  33. */
  34. public function down(): void
  35. {
  36. Schema::dropIfExists('orders');
  37. }
  38. };