<?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->enum('type', ['deposit', 'withdraw'])->index();
$table->decimal('amount', 64, 0);
$table->boolean('confirmed')->default(false);
$table->uuid('uuid')->unique();
$table->timestamps();
$table->foreign('wallet_id')
->references('id')
->on('wallets')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transactions');
}
}
|