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
58 lines
1.7 KiB
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class CreateProjectsTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('projects', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->unsignedBigInteger('business_id');
|
|
$table->string('name');
|
|
$table->string('slug');
|
|
$table->boolean('private')->default(false);
|
|
$table->unsignedBigInteger('budget')->default(0);
|
|
$table->string('color')->nullable();
|
|
$table->boolean('active')->nullable();
|
|
$table->text('description')->nullable();
|
|
$table->boolean('has_avatar')->default(false);
|
|
|
|
$table->timestamp('start')->nullable();
|
|
$table->timestamp('finish')->nullable();
|
|
|
|
$table->timestamp('created_at')->nullable();
|
|
$table->timestamp('updated_at')->useCurrent();
|
|
$table->timestamp('deleted_at')->nullable();
|
|
|
|
});
|
|
|
|
// Only those users that added directly to the project are stored here.
|
|
// Users who are members of the business have access to the projects of that business
|
|
// without being stored here.
|
|
Schema::create('project_user', function (Blueprint $table) {
|
|
$table->unsignedBigInteger('project_id');
|
|
$table->unsignedBigInteger('user_id');
|
|
$table->tinyInteger('level')->default(0);
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('projects');
|
|
Schema::dropIfExists('project_user');
|
|
}
|
|
}
|