Created casino-related migrations for users, wallets, transactions, games, promos, audits, stats
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->boolean('is_kyc_verified')->default(false)->comment('KYC-like verification status');
|
||||
$table->integer('vip_level')->default(0)->comment('VIP status: 0 = standard, 1-5 = tiers');
|
||||
$table->timestamp('last_login_at')->nullable()->comment('For tracking activity');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn(['is_kyc_verified', 'vip_level', 'last_login_at']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('wallets', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete()->comment('Links to user');
|
||||
$table->decimal('balance', 15, 2)->default(0.00)->comment('Skunk Coins balance');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('wallets');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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');
|
||||
}
|
||||
};
|
||||
26
database/migrations/2025_09_06_093949_create_games_table.php
Normal file
26
database/migrations/2025_09_06_093949_create_games_table.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?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('games', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->comment('Game name, e.g., Plinko');
|
||||
$table->string('slug')->unique()->comment('URL-friendly slug');
|
||||
$table->string('thumbnail_url')->nullable()->comment('Vibrant thumbnail for lobby');
|
||||
$table->enum('category', ['slots', 'plinko', 'wheel', 'cards', 'other'])->default('other')->comment('For filtering');
|
||||
$table->boolean('is_active')->default(true)->comment('Toggle for maintenance');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('games');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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('promo_codes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('code')->unique()->comment('Unique promo code, e.g., WELCOME100');
|
||||
$table->decimal('value', 15, 2)->comment('Skunk Coins awarded');
|
||||
$table->integer('uses_remaining')->default(-1)->comment('-1 for unlimited');
|
||||
$table->timestamp('expires_at')->nullable()->comment('Expiration date');
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('promo_codes');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
<?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('promo_code_redemptions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('promo_code_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->timestamp('redeemed_at');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('promo_code_redemptions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<?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('audit_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->nullable()->constrained()->cascadeOnDelete()->comment('Admin or player who performed action');
|
||||
$table->string('action')->comment('E.g., "updated_user_balance"');
|
||||
$table->json('details')->nullable()->comment('Before/after changes');
|
||||
$table->string('ip_address')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('audit_logs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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('player_stats', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('game_id')->nullable()->constrained()->cascadeOnDelete()->comment('Null for overall stats');
|
||||
$table->decimal('total_winnings', 15, 2)->default(0.00);
|
||||
$table->decimal('total_bets', 15, 2)->default(0.00);
|
||||
$table->integer('play_count')->default(0);
|
||||
$table->decimal('daily_play_amount', 15, 2)->default(0.00)->comment('Bets in last 24 hours');
|
||||
$table->integer('win_streak')->default(0);
|
||||
$table->timestamp('last_played_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('player_stats');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user