2020_08_21_145711_create_user_group_table.php 965 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. use App\Components\MigrationToolBox;
  3. use Illuminate\Database\Migrations\Migration;
  4. use Illuminate\Database\Schema\Blueprint;
  5. use Illuminate\Support\Facades\Schema;
  6. class CreateUserGroupTable extends Migration
  7. {
  8. /**
  9. * Run the migrations.
  10. *
  11. * @return void
  12. */
  13. public function up()
  14. {
  15. Schema::create('user_group', function (Blueprint $table) {
  16. $table->increments('id');
  17. $table->string('name')->comment('分组名称');
  18. if ((new MigrationToolBox())->versionCheck()) {
  19. $table->json('nodes')->nullable()->comment('关联的节点ID,多个用,号分隔');
  20. } else {
  21. $table->text('nodes')->nullable()->comment('关联的节点ID,多个用,号分隔');
  22. }
  23. });
  24. }
  25. /**
  26. * Reverse the migrations.
  27. *
  28. * @return void
  29. */
  30. public function down()
  31. {
  32. Schema::dropIfExists('user_group');
  33. }
  34. }