2024_02_29_024123_create_department.php 1.1 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::dropIfExists('department');
  13. Schema::create('department', function (Blueprint $table) {
  14. $table->id();
  15. $table->integer('parent_id')->default(0);
  16. $table->string('name',100);
  17. $table->integer('company_id');
  18. $table->integer('manager_id')->nullable();
  19. $table->timestamps();
  20. });
  21. }
  22. /**
  23. * Reverse the migrations.
  24. */
  25. public function down(): void
  26. {
  27. Schema::dropIfExists('department');
  28. Schema::create('department', function (Blueprint $table) {
  29. $table->id();
  30. $table->string('parent_dept',100)->nullable();
  31. $table->string('name',100)->nullable();
  32. $table->string('manager_id',100)->nullable();
  33. $table->timestamps();
  34. });
  35. }
  36. };