You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.3 KiB

4 years ago
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateRolesTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('roles', function (Blueprint $table)
  15. {
  16. // Primary key.
  17. $table->uuid('id')->primary();
  18. $table->string('name');
  19. // Foreign key for user
  20. $table->uuid('hub_id')->nullable();
  21. $table->boolean('can_hub_delete')->default(false);
  22. $table->boolean('can_hub_edit')->default(false);
  23. $table->boolean('can_user_add')->default(false);
  24. $table->boolean('can_user_remove')->default(false);
  25. $table->boolean('can_user_edit')->default(false);
  26. $table->boolean('can_file_delete')->default(false);
  27. $table->boolean('can_file_upload')->default(false);
  28. $table->boolean('can_file_download')->default(false);
  29. $table->boolean('can_file_edit')->default(false);
  30. $table->foreign('hub_id')->references('id')->on('hubs');
  31. });
  32. }
  33. /**
  34. * Reverse the migrations.
  35. *
  36. * @return void
  37. */
  38. public function down()
  39. {
  40. Schema::dropIfExists('roles');
  41. }
  42. }