%PDF- %PDF-
Direktori : /var/www/html/geotechnics/api/database/migrations/ |
Current File : /var/www/html/geotechnics/api/database/migrations/2019_09_21_140714_create_projects_table.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->bigIncrements('id'); $table->string('name'); $table->string('code') ->unique(); $table->string('person_responsible'); $table->string('person_responsible_email'); $table->string('person_responsible_phone'); $table->date('due_date'); $table->string('location'); $table->string('status') ->default(\App\Models\ProjectStatus::DRAFT); $table->softDeletes(); $table->unsignedBigInteger('manager_id') ->nullable() ->index(); $table->foreign('manager_id') ->references('id') ->on('users'); $table->unsignedBigInteger('client_id') ->nullable() ->index(); $table->foreign('client_id') ->references('id') ->on('users'); $table->timestamps(); }); Schema::create('project_service', function (Blueprint $table) { $table->unsignedBigInteger('project_id') ->nullable() ->index(); $table->unsignedBigInteger('service_id') ->nullable() ->index(); $table->foreign('project_id') ->references('id') ->on('projects'); $table->foreign('service_id') ->references('id') ->on('services'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('project_service'); Schema::dropIfExists('projects'); } }