Initialer Laravel Commit für BetiX
This commit is contained in:
91
database/migrations/2026_01_01_000009_create_game_tables.php
Normal file
91
database/migrations/2026_01_01_000009_create_game_tables.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?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
|
||||
{
|
||||
// ---------------------------------------------------------------
|
||||
// GAME BETS (bet history)
|
||||
// ---------------------------------------------------------------
|
||||
Schema::create('game_bets', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('game_name');
|
||||
$table->decimal('wager_amount', 16, 8)->default(0);
|
||||
$table->decimal('payout_multiplier', 8, 4)->default(0);
|
||||
$table->decimal('payout_amount', 16, 8)->default(0);
|
||||
$table->string('currency', 32)->default('BTX');
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_id', 'created_at']);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// USER FAVORITES (saved / bookmarked games)
|
||||
// ---------------------------------------------------------------
|
||||
Schema::create('user_favorites', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('game_slug', 128);
|
||||
$table->string('game_name', 255)->nullable();
|
||||
$table->string('game_image', 512)->nullable();
|
||||
$table->string('game_provider', 100)->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['user_id', 'game_slug']);
|
||||
$table->index('user_id');
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// USER ACHIEVEMENTS
|
||||
// ---------------------------------------------------------------
|
||||
Schema::create('user_achievements', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('achievement_key', 64); // e.g. first_bet | big_winner
|
||||
$table->timestamp('unlocked_at');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['user_id', 'achievement_key']);
|
||||
$table->index('user_id');
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// USER FEEDBACK (UX ratings & comments)
|
||||
// ---------------------------------------------------------------
|
||||
Schema::create('user_feedback', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->string('category', 30)->default('general'); // general | ux | mobile | feature | complaint
|
||||
$table->unsignedTinyInteger('overall_rating')->nullable(); // 1-5
|
||||
$table->unsignedTinyInteger('ux_rating')->nullable(); // 1-5
|
||||
$table->unsignedTinyInteger('comfort_rating')->nullable(); // 1-5
|
||||
$table->unsignedTinyInteger('mobile_rating')->nullable(); // 1-5
|
||||
$table->boolean('uses_mobile')->nullable();
|
||||
$table->unsignedTinyInteger('nps_score')->nullable(); // 1-10
|
||||
$table->text('ux_comment')->nullable();
|
||||
$table->text('mobile_comment')->nullable();
|
||||
$table->text('feature_request')->nullable();
|
||||
$table->text('improvements')->nullable();
|
||||
$table->text('general_comment')->nullable();
|
||||
$table->enum('status', ['new', 'read'])->default('new');
|
||||
$table->text('admin_note')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['status', 'created_at']);
|
||||
$table->index('user_id');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_feedback');
|
||||
Schema::dropIfExists('user_achievements');
|
||||
Schema::dropIfExists('user_favorites');
|
||||
Schema::dropIfExists('game_bets');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user