Просмотр файла database/migrations/2021_08_14_030821_create_user_fields_table.php

Размер файла: 943B
  1. <?php
  2.  
  3. declare(strict_types=1);
  4.  
  5. use App\Models\UserField;
  6. use Illuminate\Database\Migrations\Migration;
  7. use Illuminate\Database\Schema\Blueprint;
  8. use Illuminate\Support\Facades\Schema;
  9.  
  10. final class CreateUserFieldsTable extends Migration
  11. {
  12. /**
  13. * Migrate Up.
  14. */
  15. public function up(): void
  16. {
  17. if (! Schema::hasTable('user_fields')) {
  18. Schema::create('user_fields', function (Blueprint $table) {
  19. $table->increments('id');
  20. $table->integer('sort');
  21. $table->enum('type', [UserField::INPUT, UserField::TEXTAREA]);
  22. $table->string('name', 50);
  23. $table->integer('min');
  24. $table->integer('max');
  25. $table->boolean('required')->default(false);
  26. });
  27. }
  28. }
  29.  
  30. /**
  31. * Migrate Down.
  32. */
  33. public function down(): void
  34. {
  35. Schema::dropIfExists('user_fields');
  36. }
  37. }