2025_03_24_153700_create_orders_table.php 2.3 KB

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