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.

58 lines
1.7 KiB

  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateProjectsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('projects', function (Blueprint $table) {
  15. $table->id();
  16. $table->unsignedBigInteger('business_id');
  17. $table->string('name');
  18. $table->string('slug');
  19. $table->boolean('private')->default(false);
  20. $table->unsignedBigInteger('budget')->default(0);
  21. $table->string('color')->nullable();
  22. $table->boolean('active')->nullable();
  23. $table->text('description')->nullable();
  24. $table->boolean('has_avatar')->default(false);
  25. $table->timestamp('start')->nullable();
  26. $table->timestamp('finish')->nullable();
  27. $table->timestamp('created_at')->nullable();
  28. $table->timestamp('updated_at')->useCurrent();
  29. $table->timestamp('deleted_at')->nullable();
  30. });
  31. // Only those users that added directly to the project are stored here.
  32. // Users who are members of the business have access to the projects of that business
  33. // without being stored here.
  34. Schema::create('project_user', function (Blueprint $table) {
  35. $table->unsignedBigInteger('project_id');
  36. $table->unsignedBigInteger('user_id');
  37. $table->tinyInteger('level')->default(0);
  38. });
  39. }
  40. /**
  41. * Reverse the migrations.
  42. *
  43. * @return void
  44. */
  45. public function down()
  46. {
  47. Schema::dropIfExists('projects');
  48. Schema::dropIfExists('project_user');
  49. }
  50. }