26 lines
908 B
PHP
26 lines
908 B
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('transactions', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('wallet_id')->constrained()->cascadeOnDelete()->comment('Links to wallet');
|
|
$table->decimal('amount', 15, 2)->comment('Amount transacted');
|
|
$table->enum('type', ['bet', 'win', 'deposit', 'withdrawal'])->comment('Transaction type');
|
|
$table->text('description')->nullable()->comment('Details, e.g., "Bet on Plinko"');
|
|
$table->string('hash')->comment('SHA-256 hash for validation');
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('transactions');
|
|
}
|
|
}; |