2025_09_22_162208_create_schedules_table.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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('schedules', function (Blueprint $table) {
  13. $table->id();
  14. $table->date('installation_date');
  15. $table->boolean('manual')->default(false);
  16. $table->foreignId('order_id')->nullable()->constrained('orders')->cascadeOnDelete();
  17. $table->foreignId('district_id')->constrained('districts')->cascadeOnDelete();
  18. $table->foreignId('area_id')->constrained('areas')->cascadeOnDelete();
  19. $table->text('object_address');
  20. $table->string('source')->default('Ручной');
  21. $table->string('address_code')->nullable();
  22. $table->string('object_type')->nullable();
  23. $table->text('mafs');
  24. $table->integer('mafs_count');
  25. $table->foreignId('brigadier_id')->constrained('users')->cascadeOnDelete();
  26. $table->text('comment')->nullable();
  27. $table->timestamps();
  28. });
  29. }
  30. /**
  31. * Reverse the migrations.
  32. */
  33. public function down(): void
  34. {
  35. Schema::dropIfExists('schedules');
  36. }
  37. };