-
Notifications
You must be signed in to change notification settings - Fork 1
/
2020_01_29_025709_create_transactions_table.php
61 lines (54 loc) · 1.65 KB
/
2020_01_29_025709_create_transactions_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
58
59
60
61
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTransactionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transactions', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('wallet_id');
$table->unsignedBigInteger('sub_wallet_id');
$table->unsignedBigInteger('invoice_id')->unique();
$table->unsignedBigInteger('seller_branch_id');
$table->integer('amount');
$table->string('state');
$table->foreign('wallet_id')
->references('id')
->on('wallets')
->onDelete('cascade')
->onUpdate('cascade');
$table->foreign('sub_wallet_id')
->references('id')
->on('sub_wallets')
->onDelete('cascade')
->onUpdate('cascade');
$table->foreign('invoice_id')
->references('id')
->on('invoices')
->onDelete('cascade')
->onUpdate('cascade');
$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('transactions');
}
}