2024_11_25_144246_admin_user_level.php 1017 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. use Kalnoy\Nestedset\NestedSet;
  6. return new class extends Migration
  7. {
  8. /**
  9. * Run the migrations.
  10. *
  11. * @return void
  12. */
  13. public function up()
  14. {
  15. Schema::create('admin_user_level', function (Blueprint $table) {
  16. //主键ID
  17. $table->id();
  18. //备注
  19. $table->string('remark')->default('');
  20. //在此添加此方法,nestedset将会自动生成:_lft、_rgt、parent_id三个字段
  21. NestedSet::columns($table);
  22. //根据实际场景需要决定需不需要软删除
  23. $table->softDeletes();
  24. //添加创建时间、更新时间字段
  25. $table->timestamps();
  26. });
  27. }
  28. /**
  29. * Reverse the migrations.
  30. *
  31. * @return void
  32. */
  33. public function down()
  34. {
  35. Schema::dropIfExists('admin_user_level');
  36. }
  37. };