Completed
Push — master ( f2f6fa...1beb9c )
by claudio
03:43
created

CreateEmployeesTable::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 14
rs 9.4286
cc 1
eloc 11
nc 1
nop 0
1
<?php
2
3
use Illuminate\Database\Schema\Blueprint;
4
use Illuminate\Database\Migrations\Migration;
5
6
class CreateEmployeesTable extends Migration
7
{
8
    /**
9
     * Run the migrations.
10
     *
11
     * @return void
12
     */
13
    public function up()
14
    {
15
        Schema::create('employees', function (Blueprint $table) {
16
            $table->increments('id');
17
            $table->string('name');
18
            $table->string('email');
19
            $table->string('password', 60);
20
            $table->integer('company_id')->unsigned();
21
            $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade');
22
            $table->rememberToken();
23
            $table->timestamps();
24
            $table->unique(['email', 'company_id']);
25
        });
26
    }
27
28
    /**
29
     * Reverse the migrations.
30
     *
31
     * @return void
32
     */
33
    public function down()
34
    {
35
        Schema::drop('employees');
36
    }
37
}
38