/ database / migrations / 2021_08_09_075756_create_consultants_table.php
2021_08_09_075756_create_consultants_table.php
 1  <?php
 2  
 3  use Illuminate\Database\Migrations\Migration;
 4  use Illuminate\Database\Schema\Blueprint;
 5  use Illuminate\Support\Facades\Schema;
 6  
 7  class CreateConsultantsTable extends Migration
 8  {
 9      /**
10       * Run the migrations.
11       *
12       * @return void
13       */
14      public function up()
15      {
16          Schema::create('consultants', function (Blueprint $table) {
17              $table->id();
18              $table->string('name');
19              $table->string('position');
20              $table->string('telephone');
21              $table->string('email')->unique();
22  
23              $table->foreignId('country_id')->nullable()->constrained('countries')->cascadeOnUpdate()->nullOnDelete();
24              $table->foreignId('consultancy_id')->nullable()->constrained('consultancies')->cascadeOnUpdate()->nullOnDelete();
25  
26              $table->timestamps();
27          });
28      }
29  
30      /**
31       * Reverse the migrations.
32       *
33       * @return void
34       */
35      public function down()
36      {
37          Schema::dropIfExists('personalcon');
38      }
39  }