-
Notifications
You must be signed in to change notification settings - Fork 1
/
2020_01_29_023513_create_risponsibles_table.php
57 lines (52 loc) · 1.58 KB
/
2020_01_29_023513_create_risponsibles_table.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateRisponsiblesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('risponsibles', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('company_id')->unique();
$table->unsignedBigInteger('seller_branch_id');
$table->string('name');
$table->unsignedDecimal('phone');
$table->string('email');
$table->string('username');
$table->string('password');
$table->string('location');
$table->timestamp('creation_date');
$table->foreign('company_id')
->references('id')
->on('companies')
->onDelete('cascade')
->onUpdate('cascade');
/*seller_branch has many responsible*/
/*
ALTER TABLE risponsibles
ADD FOREIGN KEY (seller_branch_id) REFERENCES seller_branches(id);
*/
// $table->foreign('seller_branch_id')
// ->references('id')
// ->on('seller_branches')
// ->onDelete('cascade')
// ->onUpdate('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('risponsibles');
}
}