Initialer Laravel Commit für BetiX
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
<?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
|
||||
{
|
||||
// ---------------------------------------------------------------
|
||||
// APP SETTINGS (key-value store for site configuration)
|
||||
// ---------------------------------------------------------------
|
||||
Schema::create('app_settings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('key')->unique();
|
||||
$table->json('value');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// USER RESTRICTIONS (bans, chat bans, etc.)
|
||||
// ---------------------------------------------------------------
|
||||
Schema::create('user_restrictions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
|
||||
$table->string('type', 64); // account_ban | chat_ban | deposit_block | withdrawal_block | support_block
|
||||
$table->string('reason', 255)->nullable();
|
||||
$table->text('notes')->nullable();
|
||||
$table->foreignId('imposed_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamp('starts_at')->nullable();
|
||||
$table->timestamp('ends_at')->nullable();
|
||||
$table->boolean('active')->default(true);
|
||||
$table->string('source', 64)->nullable(); // api | admin_panel | system
|
||||
$table->json('metadata')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index(['user_id', 'type', 'active']);
|
||||
$table->index(['user_id', 'active']);
|
||||
$table->index('ends_at');
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// TIPS (peer-to-peer balance transfers)
|
||||
// ---------------------------------------------------------------
|
||||
Schema::create('tips', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('from_user_id')->constrained('users')->cascadeOnDelete();
|
||||
$table->foreignId('to_user_id')->constrained('users')->cascadeOnDelete();
|
||||
$table->string('currency', 10);
|
||||
$table->decimal('amount', 20, 8);
|
||||
$table->string('note', 140)->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['from_user_id', 'to_user_id']);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// NOTIFICATIONS (Laravel default notification table)
|
||||
// ---------------------------------------------------------------
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('type');
|
||||
$table->morphs('notifiable');
|
||||
$table->text('data');
|
||||
$table->timestamp('read_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
Schema::dropIfExists('tips');
|
||||
Schema::dropIfExists('user_restrictions');
|
||||
Schema::dropIfExists('app_settings');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user