2026_05_06_151148_create_dict_sections_table.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. /*
  6. * Миграция: создаёт таблицу dict_sections — разделы справочников.
  7. * Создана: 2026-05-06
  8. * code — уникальный строковый идентификатор ('makes', 'body_types', 'colors_ext' и т.д.)
  9. * is_system — защита от удаления через UI (системные разделы заполняются DictionarySeeder)
  10. * is_hierarchical — если true: значения двухуровневые (Марка → Модели), иначе плоский список
  11. * Нет timestamps — статичные справочные данные не требуют отслеживания времени
  12. */
  13. return new class extends Migration
  14. {
  15. public function up(): void
  16. {
  17. Schema::create('dict_sections', function (Blueprint $table) {
  18. $table->unsignedBigInteger('id')->autoIncrement();
  19. $table->string('code', 64)->unique();
  20. $table->string('label', 128);
  21. $table->boolean('is_system')->default(false);
  22. $table->boolean('is_hierarchical')->default(false);
  23. $table->smallInteger('sort_order')->default(0);
  24. });
  25. }
  26. /**
  27. * Reverse the migrations.
  28. */
  29. public function down(): void
  30. {
  31. Schema::dropIfExists('dict_sections');
  32. }
  33. };