mirror of
https://gitlab.com/izyim/wetrack.git
synced 2026-08-19 04:23:57 +00:00
38 lines
919 B
PHP
38 lines
919 B
PHP
<?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->string('name');
|
|
$table->text('description')->nullable();
|
|
$table->unsignedBigInteger('parent_id')->nullable();
|
|
$table->foreign('parent_id')->references('id')->on('projects')->onDelete('cascade');
|
|
$table->unique(['name','parent_id']);
|
|
$table->softDeletes();
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('projects');
|
|
}
|
|
}
|