Lae/database/migrations/2022_09_01_033240_create_balances_table.php

51 lines
1.1 KiB
PHP
Raw Normal View History

2022-09-01 09:48:29 +00:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
2022-09-01 09:48:29 +00:00
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('balances', function (Blueprint $table) {
$table->id();
// order id
$table->string('order_id')->nullable()->index();
// trade id
$table->string('trade_id')->nullable()->index();
// payment
$table->string('payment')->nullable()->index();
// amount
$table->decimal('amount', 10, 2)->default(0);
// paid_at
$table->timestamp('paid_at')->nullable();
// user id
$table->unsignedBigInteger('user_id')->nullable()->index();
$table->foreign('user_id')->references('id')->on('users');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('balances');
}
};