2024_09_03_060029_create_system_departments_table.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  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('system_departments', function (Blueprint $table) {
  13. $table->id();
  14. $table->string('name')->comment('部门名称');
  15. $table->bigInteger('parent_id')->default(0)->comment('父部门ID');
  16. $table->integer('sort')->default(0)->comment('显示顺序');
  17. $table->bigInteger('leader_user_id')->nullable()->comment('负责人');
  18. $table->string('phone')->nullable()->comment('联系电话');
  19. $table->string('email')->nullable()->comment('邮箱');
  20. $table->tinyInteger('status')->default(0)->comment('部门状态');
  21. $table->string('creator', 64)->nullable()->comment('创建者');
  22. $table->string('updater', 64)->nullable()->comment('更新者');
  23. $table->timestamps();
  24. });
  25. }
  26. /**
  27. * Reverse the migrations.
  28. */
  29. public function down(): void
  30. {
  31. Schema::dropIfExists('system_departments');
  32. }
  33. };