File: /var/www/console.fixgini.com/database/migrations/2024_04_23_003123_create_wallets_table.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('wallets', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->decimal('available', 16, 2)->default('0.00'); // Using decimal to store monetary values
$table->decimal('withdraw', 16, 2)->default('0.00'); // Nullable for optional values
$table->decimal('pending', 16, 2)->default('0.00'); // Nullable for optional values
$table->string('pending_withdraw', 16, 2)->default('0.00');
$table->string('currency');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('wallets');
}
};