Initial commit

This commit is contained in:
root
2026-05-09 17:28:23 +02:00
commit 9d73f82529
5575 changed files with 281989 additions and 0 deletions
+91
View File
@@ -0,0 +1,91 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\ConsoleOutput;
class CoreSqlFile extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Only run in testing environment
if (app()->environment() !== 'testing') {
return;
}
ini_set('memory_limit', '-1');
if (! Schema::hasTable('users')) {
$output = new ConsoleOutput;
$output->writeln("\n🚀 Running Core SQL File Migration...");
// Set charset to support emojis
DB::statement('SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci');
$sqlFile = database_path('migrations/sqls/default.sql');
$sql = file_get_contents($sqlFile);
// Split into individual statements to show progress
$statements = array_filter(
preg_split('/;\s*\n/', $sql),
fn ($stmt) => ! empty(trim($stmt)) &&
! str_starts_with(trim($stmt), '--') &&
! str_starts_with(trim($stmt), '/*'),
);
$totalStatements = count($statements);
$output->writeln("📊 Processing $totalStatements SQL statements...");
$progressBar = new ProgressBar($output, $totalStatements);
$progressBar->setFormat(' %current%/%max% [%bar%] %percent:3s%% %message%');
$progressBar->setMessage('Starting...');
$progressBar->start();
foreach ($statements as $index => $statement) {
$statement = trim($statement);
if (! empty($statement)) {
try {
DB::unprepared($statement);
// Update progress message based on statement type
if (str_contains($statement, 'CREATE TABLE')) {
preg_match('/CREATE TABLE\s+`?(\w+)`?/i', $statement, $matches);
$tableName = $matches[1] ?? 'unknown';
$progressBar->setMessage("Created table: $tableName");
} elseif (str_contains($statement, 'INSERT INTO')) {
$progressBar->setMessage('Inserting data...');
} else {
$progressBar->setMessage('Processing...');
}
} catch (Exception $e) {
$progressBar->setMessage('Error: ' . substr($e->getMessage(), 0, 50) . '...');
// Continue on non-critical errors
}
}
$progressBar->advance();
// Small delay to make progress visible
if ($index % 100 === 0) {
usleep(1000); // 1ms
}
}
$progressBar->setMessage('✅ Complete!');
$progressBar->finish();
$output->writeln("\n🎉 Core SQL schema imported successfully!");
} else {
$output = new ConsoleOutput;
$output->writeln('️ Core tables already exist, skipping SQL import.');
}
}
}
@@ -0,0 +1,32 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('password_resets')) {
Schema::rename('password_resets', sprintf('password_resets_%s', time()));
}
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('password_resets');
}
};
@@ -0,0 +1,58 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Laravel\Fortify\Fortify;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
if (columnExists('users', 'two_factor_secret')) {
Schema::dropColumns('users', 'two_factor_secret');
}
if (columnExists('users', 'two_factor_recovery_codes')) {
Schema::dropColumns('users', 'two_factor_recovery_codes');
}
$table->text('two_factor_secret')
->after('password')
->nullable();
$table->text('two_factor_recovery_codes')
->after('two_factor_secret')
->nullable();
if (Fortify::confirmsTwoFactorAuthentication()) {
if (columnExists('users', 'two_factor_confirmed_at')) {
Schema::dropColumns('users', 'two_factor_confirmed_at');
}
$table->timestamp('two_factor_confirmed_at')
->after('two_factor_recovery_codes')
->nullable();
}
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(array_merge([
'two_factor_secret',
'two_factor_recovery_codes',
], Fortify::confirmsTwoFactorAuthentication() ? [
'two_factor_confirmed_at',
] : []));
});
}
};
@@ -0,0 +1,36 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('failed_jobs')) {
Schema::rename('failed_jobs', sprintf('failed_jobs_%s', time()));
}
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('failed_jobs');
}
};
@@ -0,0 +1,36 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('personal_access_tokens')) {
Schema::rename('personal_access_tokens', sprintf('personal_access_tokens_%s', time()));
}
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};
@@ -0,0 +1,31 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable(config('activitylog.table_name'))) {
Schema::rename(config('activitylog.table_name'), sprintf('%s_%s', config('activitylog.table_name'), time()));
}
Schema::connection(config('activitylog.database_connection'))->create(config('activitylog.table_name'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('log_name')->nullable();
$table->text('description');
$table->nullableMorphs('subject', 'subject');
$table->nullableMorphs('causer', 'causer');
$table->json('properties')->nullable();
$table->timestamps();
$table->index('log_name');
});
}
public function down(): void
{
Schema::connection(config('activitylog.database_connection'))->dropIfExists(config('activitylog.table_name'));
}
};
@@ -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::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
if (! columnExists(config('activitylog.table_name'), 'event')) {
$table->string('event')->nullable()->after('subject_type');
}
});
}
public function down(): void
{
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
$table->dropColumn('event');
});
}
};
@@ -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::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
if (! columnExists(config('activitylog.table_name'), 'batch_uuid')) {
$table->uuid('batch_uuid')->nullable()->after('properties');
}
});
}
public function down(): void
{
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
$table->dropColumn('batch_uuid');
});
}
};
@@ -0,0 +1,27 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_settings')) {
Schema::rename('website_settings', sprintf('website_settings_%s', time()));
}
Schema::create('website_settings', function (Blueprint $table) {
$table->id();
$table->string('key')->unique();
$table->string('value');
$table->string('comment')->comment('Add an explanation of the setting does');
});
}
public function down(): void
{
Schema::dropIfExists('website_settings');
}
};
@@ -0,0 +1,33 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_articles')) {
dropForeignKeyIfExists('website_articles', 'user_id');
Schema::rename('website_articles', sprintf('website_articles_%s', time()));
}
Schema::create('website_articles', function (Blueprint $table) {
$table->id();
$table->string('slug')->unique();
$table->string('title');
$table->string('short_story');
$table->longText('full_story');
$table->string('user_id');
$table->string('image');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('website_articles');
}
};
@@ -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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_languages')) {
Schema::rename('website_languages', sprintf('website_languages_%s', time()));
}
Schema::create('website_languages', function (Blueprint $table) {
$table->id();
$table->string('country_code', 8)->unique();
$table->string('language')->unique();
});
}
public function down(): void
{
Schema::dropIfExists('website_languages');
}
};
@@ -0,0 +1,34 @@
<?php
use App\Models\User;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
return new class extends Migration
{
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
if (columnExists('users', 'referral_code')) {
Schema::dropColumns('users', 'referral_code');
}
$table->string('referral_code')->nullable()->unique()->after('home_room');
});
foreach (User::whereNull('referral_code')->get() as $user) {
$user->update(['referral_code' => sprintf('%s%s', $user->id, Str::random(8))]);
}
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('referral_code');
});
});
}
};
@@ -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
{
public function up(): void
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('user_referrals')) {
dropForeignKeyIfExists('user_referrals', 'user_id');
Schema::rename('user_referrals', sprintf('user_referrals_%s', time()));
}
Schema::create('user_referrals', function (Blueprint $table) {
$table->id();
$table->integer('user_id');
$table->unsignedBigInteger('referrals_total');
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('user_referrals');
}
};
@@ -0,0 +1,31 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('referrals')) {
dropForeignKeyIfExists('referrals', 'user_id');
Schema::rename('referrals', sprintf('referrals_%s', time()));
}
Schema::create('referrals', function (Blueprint $table) {
$table->id();
$table->integer('user_id')->index();
$table->unsignedBigInteger('referred_user_id');
$table->string('referred_user_ip');
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('referrals');
}
};
@@ -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
{
public function up(): void
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('claimed_referral_logs')) {
dropForeignKeyIfExists('claimed_referral_logs', 'user_id');
Schema::rename('claimed_referral_logs', sprintf('claimed_referral_logs_%s', time()));
}
Schema::create('claimed_referral_logs', function (Blueprint $table) {
$table->id();
$table->integer('user_id')->index();
$table->string('ip_address');
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users');
});
}
public function down(): void
{
Schema::dropIfExists('claimed_referral_logs');
}
};
@@ -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()
{
Schema::create('website_housekeeping_permissions', function (Blueprint $table) {
$table->id();
$table->string('permission')->unique();
$table->integer('min_rank');
$table->string('description')->comment('Describes the permissions')->nullable();
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('housekeeping_permissions');
}
};
@@ -0,0 +1,19 @@
<?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::table('users', function (Blueprint $table) {
if (columnExists('users', 'hidden_staff')) {
Schema::dropColumns('users', 'hidden_staff');
}
$table->boolean('hidden_staff')->after('rank')->default(false);
});
}
};
@@ -0,0 +1,19 @@
<?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::table('permissions', function (Blueprint $table) {
if (columnExists('permissions', 'hidden_rank')) {
Schema::dropColumns('permissions', 'hidden_rank');
}
$table->boolean('hidden_rank')->after('rank_name')->default(false);
});
}
};
@@ -0,0 +1,16 @@
<?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::table('website_articles', function (Blueprint $table) {
$table->integer('user_id')->nullable()->change();
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
});
}
};
@@ -0,0 +1,28 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_ip_whitelist')) {
Schema::rename('website_ip_whitelist', sprintf('website_ip_whitelist_%s', time()));
}
Schema::create('website_ip_whitelist', function (Blueprint $table) {
$table->id();
$table->string('ip_address');
$table->string('asn')->nullable();
$table->boolean('whitelist_asn')->default(false);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('website_ip_whitelist');
}
};
@@ -0,0 +1,28 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_ip_blacklist')) {
Schema::rename('website_ip_blacklist', sprintf('website_ip_blacklist_%s', time()));
}
Schema::create('website_ip_blacklist', function (Blueprint $table) {
$table->id();
$table->string('ip_address');
$table->string('asn')->nullable();
$table->boolean('blacklist_asn')->default(false);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('website_ip_blacklist');
}
};
@@ -0,0 +1,28 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_permissions')) {
Schema::rename('website_permissions', sprintf('website_permissions_%s', time()));
}
Schema::create('website_permissions', function (Blueprint $table) {
$table->id();
$table->string('key')->unique();
$table->string('value')->nullable();
$table->string('comment')->comment('Explanation on what the permission is used for')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('website_permissions');
}
};
@@ -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::table('permissions', function (Blueprint $table) {
if (columnExists('permissions', 'job_description')) {
Schema::dropColumns('permissions', 'job_description');
}
if (columnExists('permissions', 'staff_color')) {
Schema::dropColumns('permissions', 'staff_color');
}
$table->string('job_description')->default('Here to help')->after('badge');
$table->string('staff_color', 8)->default('#327fa8')->after('job_description');
});
}
};
@@ -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::table('permissions', function (Blueprint $table) {
if (columnExists('permissions', 'staff_background')) {
Schema::dropColumns('permissions', 'staff_background');
}
$table->string('staff_background')->default('staff-bg.png')->after('staff_color');
});
}
public function down(): void
{
Schema::table('permissions', function (Blueprint $table) {});
}
};
@@ -0,0 +1,36 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_article_reactions')) {
dropForeignKeyIfExists('website_article_reactions', 'article_id');
Schema::rename('website_article_reactions', sprintf('website_article_reactions_%s', time()));
}
Schema::create('website_article_reactions', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('user_id');
$table->unsignedBigInteger('article_id');
$table->string('reaction', 50);
$table->boolean('active')->default(true);
$table->foreign('article_id')->references('id')->on('website_articles')->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('website_article_reactions');
}
};
@@ -0,0 +1,36 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('users_session_logs')) {
Schema::rename('users_session_logs', sprintf('users_session_logs_%s', time()));
}
Schema::create('users_session_logs', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('user_id');
$table->string('ip', 100)->default('0');
$table->text('browser')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users_session_logs');
}
};
@@ -0,0 +1,36 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('sessions')) {
dropForeignKeyIfExists('sessions', 'user_id');
Schema::rename('sessions', sprintf('sessions_%s', time()));
}
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('sessions');
}
};
@@ -0,0 +1,32 @@
<?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::dropIfExists('users_session_logs');
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::create('users_session_logs', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('user_id');
$table->string('ip', 100)->default('0');
$table->text('browser')->nullable();
$table->timestamps();
});
}
};
@@ -0,0 +1,21 @@
<?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::table('users', function (Blueprint $table) {
if (columnExists('users', 'two_factor_confirmed')) {
Schema::dropColumns('users', 'two_factor_confirmed');
}
$table->boolean('two_factor_confirmed')
->after('two_factor_recovery_codes')
->default(false);
});
}
};
@@ -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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_wordfilter')) {
Schema::rename('website_wordfilter', sprintf('website_wordfilter_%s', time()));
}
Schema::create('website_wordfilter', function (Blueprint $table) {
$table->id();
$table->string('word')->unique();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('website_wordfilter');
}
};
@@ -0,0 +1,27 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_beta_codes')) {
Schema::rename('website_beta_codes', sprintf('website_beta_codes_%s', time()));
}
Schema::create('website_beta_codes', function (Blueprint $table) {
$table->id();
$table->string('code')->unique();
$table->integer('user_id')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('website_beta_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
{
DB::table('website_permissions')->truncate();
Schema::table('website_permissions', function (Blueprint $table) {
$table->renameColumn('key', 'permission');
});
Schema::table('website_permissions', function (Blueprint $table) {
$table->renameColumn('value', 'min_rank');
});
Schema::table('website_permissions', function (Blueprint $table) {
$table->renameColumn('comment', 'description');
});
}
};
@@ -0,0 +1,31 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_teams')) {
Schema::rename('website_teams', sprintf('website_teams_%s', time()));
}
Schema::create('website_teams', function (Blueprint $table) {
$table->id();
$table->string('rank_name')->unique();
$table->boolean('hidden_rank')->default(false);
$table->string('badge')->nullable();
$table->string('job_description')->nullable();
$table->string('staff_color')->default('#327fa8');
$table->string('staff_background')->default('staff-bg.png');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('website_teams');
}
};
@@ -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
{
if (Schema::hasColumn('users', 'team_id')) {
dropForeignKeyIfExists('users', 'team_id');
Schema::dropColumns('users', 'team_id');
}
Schema::table('users', function (Blueprint $table) {
if (! Schema::hasColumn('users', 'team_id')) {
$table->unsignedBigInteger('team_id')->nullable();
}
$table->foreign('team_id')->references('id')->on('website_teams')->nullOnDelete();
});
}
};
@@ -0,0 +1,33 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_staff_applications')) {
dropForeignKeyIfExists('website_staff_applications', 'user_id');
dropForeignKeyIfExists('website_staff_applications', 'rank_id');
Schema::rename('website_staff_applications', sprintf('website_staff_applications_%s', time()));
}
Schema::create('website_staff_applications', function (Blueprint $table) {
$table->id();
$table->integer('user_id');
$table->integer('rank_id');
$table->text('content');
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
$table->foreign('rank_id')->references('id')->on('permissions')->cascadeOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('website_staff_applications');
}
};
@@ -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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_open_positions')) {
Schema::rename('website_open_positions', sprintf('website_open_positions_%s', time()));
}
Schema::create('website_open_positions', function (Blueprint $table) {
$table->id();
$table->integer('permission_id');
$table->string('description');
$table->timestamp('apply_from')->nullable();
$table->timestamp('apply_to')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('website_open_positions');
}
};
@@ -0,0 +1,33 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_article_comments')) {
dropForeignKeyIfExists('website_article_comments', 'article_id');
dropForeignKeyIfExists('website_article_comments', 'user_id');
Schema::rename('website_article_comments', sprintf('website_article_comments_%s', time()));
}
Schema::create('website_article_comments', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('article_id');
$table->integer('user_id');
$table->string('comment');
$table->timestamps();
$table->foreign('article_id')->references('id')->on('website_articles')->cascadeOnDelete();
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('website_article_comments');
}
};
@@ -0,0 +1,28 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_rare_value_categories')) {
Schema::rename('website_rare_value_categories', sprintf('website_rare_value_categories_%s', time()));
}
Schema::create('website_rare_value_categories', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->string('badge');
$table->unsignedInteger('priority')->default(1);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('website_rare_value_categories');
}
};
@@ -0,0 +1,38 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_rare_values')) {
dropForeignKeyIfExists('website_rare_values', 'category_id');
Schema::rename('website_rare_values', sprintf('website_rare_values_%s', time()));
}
Schema::create('website_rare_values', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('category_id');
$table->integer('item_id')->nullable()->index();
$table->string('name')->index();
$table->string('credit_value')->nullable();
$table->string('currency_value')->nullable();
$table->string('currency_type')->default('diamonds');
$table->string('furniture_icon');
$table->timestamps();
$table->foreign('category_id')
->references('id')
->on('website_rare_value_categories')
->cascadeOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('website_rare_values');
}
};
@@ -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
{
public function up(): void
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_rule_categories')) {
Schema::rename('website_rule_categories', sprintf('website_rule_categories_%s', time()));
}
Schema::create('website_rule_categories', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->string('description');
$table->string('badge');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('website_rule_categories');
}
};
@@ -0,0 +1,33 @@
<?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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_rules')) {
dropForeignKeyIfExists('website_rules', 'category_id');
Schema::rename('website_rules', sprintf('website_rules_%s', time()));
}
Schema::create('website_rules', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('category_id')->nullable();
$table->string('paragraph', 8);
$table->text('rule');
$table->timestamps();
$table->foreign('category_id')->references('id')->on('website_rule_categories')->nullOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('website_rules');
}
};
@@ -0,0 +1,19 @@
<?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::table('website_articles', function (Blueprint $table) {
if (columnExists('website_articles', 'deleted_at')) {
Schema::dropColumns('website_articles', 'deleted_at');
}
$table->softDeletes()->after('updated_at');
});
}
};
@@ -0,0 +1,19 @@
<?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::table('website_articles', function (Blueprint $table) {
if (columnExists('website_articles', 'can_comment')) {
Schema::dropColumns('website_articles', 'can_comment');
}
$table->boolean('can_comment')->default(true)->after('image');
});
}
};
@@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::rename('password_resets', 'password_reset_tokens');
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::rename('password_reset_tokens', 'password_resets');
}
};
@@ -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
{
if (config('habbo.migrations.rename_tables') && Schema::hasTable('website_installation')) {
Schema::rename('website_installation', sprintf('website_installation_%s', time()));
}
Schema::create('website_installation', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('step')->default(0)->nullable();
$table->boolean('completed')->default(false);
$table->string('installation_key')->nullable();
$table->string('user_ip')->nullable();
$table->timestamps();
});
}
};
@@ -0,0 +1,17 @@
<?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::table('permissions', function (Blueprint $table) {
if (Schema::hasColumn('permissions', 'can_apply')) {
Schema::dropColumns('permissions', 'can_apply');
}
});
}
};
@@ -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('website_help_center_categories', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->text('content');
$table->unsignedInteger('position')->default(1);
$table->string('image_url')->nullable();
$table->string('button_text')->nullable();
$table->string('button_url')->nullable();
$table->string('button_color', 16)->default('#eeb425');
$table->string('button_border_color', 16)->default('#facc15');
$table->boolean('small_box')->default(false);
});
}
public function down(): void
{
Schema::dropIfExists('website_help_center_categories');
}
};
@@ -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
{
public function up(): void
{
Schema::create('website_help_center_tickets', function (Blueprint $table) {
$table->id();
$table->integer('user_id')->nullable();
$table->unsignedBigInteger('category_id')->nullable();
$table->string('title');
$table->text('content');
$table->boolean('open')->default(true);
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
$table->foreign('category_id')->references('id')->on('website_help_center_categories')->cascadeOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('website_help_center_tickets');
}
};
@@ -0,0 +1,37 @@
<?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('website_paypal_transactions', function (Blueprint $table) {
$table->id();
$table->integer('user_id');
$table->string('transaction_id');
$table->string('status')->nullable();
$table->string('description', 512)->nullable();
$table->float('amount');
$table->string('currency')->default('USD');
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('website_paypal_transactions');
}
};
@@ -0,0 +1,43 @@
<?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('website_shop_articles', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->string('info');
$table->string('icon');
$table->string('color');
$table->unsignedInteger('costs');
$table->integer('give_rank')->nullable();
$table->unsignedInteger('credits')->nullable();
$table->unsignedInteger('duckets')->nullable();
$table->unsignedInteger('diamonds')->nullable();
$table->string('badges')->nullable();
$table->json('furniture')->nullable();
$table->unsignedInteger('position')->default(0);
$table->timestamps();
$table->foreign('give_rank')->references('id')->on('permissions')->nullOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('website_shop_articles');
}
};
@@ -0,0 +1,22 @@
<?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::table('users', function (Blueprint $table) {
$table->unsignedInteger('website_balance')->default(0)->after('referral_code');
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
//
});
}
};
@@ -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('website_shop_vouchers', function (Blueprint $table) {
$table->id();
$table->string('code')->unique();
$table->unsignedInteger('max_uses')->default(1);
$table->unsignedInteger('use_count')->default(0);
$table->unsignedInteger('amount');
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('website_shop_vouchers');
}
};
@@ -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('website_used_shop_vouchers', function (Blueprint $table) {
$table->id();
$table->integer('user_id');
$table->unsignedBigInteger('voucher_id');
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
$table->foreign('voucher_id')->references('id')->on('website_shop_vouchers')->cascadeOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('website_used_shop_vouchers');
}
};
@@ -0,0 +1,27 @@
<?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('website_shop_article_features', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('article_id');
$table->json('features');
$table->timestamps();
$table->foreign('article_id')->references('id')->on('website_shop_articles')->cascadeOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('website_shop_article_features');
}
};
@@ -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
{
public function up(): void
{
Schema::create('website_help_center_ticket_replies', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('ticket_id');
$table->integer('user_id');
$table->text('content');
$table->timestamps();
$table->foreign('ticket_id')->references('id')->on('website_help_center_tickets')->cascadeOnDelete();
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('website_help_center_ticket_replies');
}
};
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
DB::table('website_shop_article_features')->truncate();
Schema::table('website_shop_article_features', function (Blueprint $table) {
$table->renameColumn('features', 'content');
});
Schema::table('website_shop_article_features', function (Blueprint $table) {
$table->string('content')->change();
});
}
public function down(): void
{
Schema::table('website_shop_article_features', function (Blueprint $table) {
//
});
}
};
@@ -0,0 +1,22 @@
<?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::table('website_shop_articles', function (Blueprint $table) {
$table->renameColumn('icon', 'icon_url');
});
}
public function down(): void
{
Schema::table('website_shop_articles', function (Blueprint $table) {
$table->renameColumn('icon_url', 'icon');
});
}
};
@@ -0,0 +1,28 @@
<?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('items', function (Blueprint $table) {
$table->index(['item_id'], 'items_item_id_index');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('items', function (Blueprint $table) {
$table->dropIndex('items_item_id_index');
});
}
};
@@ -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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('password_reset_tokens', function (Blueprint $table) {
$table->timestamp('created_at')->useCurrent()->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};
@@ -0,0 +1,33 @@
<?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('alert_logs', function (Blueprint $table) {
$table->id();
$table->string('type');
$table->string('severity');
$table->text('message');
$table->json('context')->nullable();
$table->boolean('sent_via_email')->default(false);
$table->boolean('sent_via_discord')->default(false);
$table->boolean('is_read')->default(false);
$table->timestamp('read_at')->nullable();
$table->timestamps();
$table->index(['type', 'created_at']);
$table->index(['severity', 'created_at']);
$table->index('is_read');
});
}
public function down(): void
{
Schema::dropIfExists('alert_logs');
}
};
@@ -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
{
public function up(): void
{
Schema::create('website_user_guestbooks', function (Blueprint $table) {
$table->id();
$table->integer('profile_id');
$table->integer('user_id');
$table->string('message');
$table->timestamps();
$table->foreign('profile_id')->references('id')->on('users')->cascadeOnDelete();
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('website_user_guestbooks');
}
};
@@ -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('website_shop_categories', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('slug')->unique();
$table->string('icon')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('website_shop_categories');
}
};
@@ -0,0 +1,16 @@
<?php
use App\Models\Shop\WebsiteShopCategory;
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::table('website_shop_articles', function (Blueprint $table) {
$table->foreignIdFor(WebsiteShopCategory::class)->after('id')->nullable();
});
}
};
@@ -0,0 +1,15 @@
<?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::table('website_shop_articles', function (Blueprint $table) {
$table->boolean('is_giftable')->default(true)->after('position');
});
}
};
@@ -0,0 +1,28 @@
<?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('website_maintenance_tasks', function (Blueprint $table) {
$table->id();
$table->integer('user_id')->nullable();
$table->string('task');
$table->boolean('completed')->default(false);
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->nullOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('website_maintenance_tasks');
}
};
@@ -0,0 +1,15 @@
<?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::table('website_settings', function (Blueprint $table) {
$table->text('value')->change();
});
}
};
@@ -0,0 +1,31 @@
<?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('tags', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('background_color', 10);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tags');
}
};
@@ -0,0 +1,28 @@
<?php
use App\Models\Articles\Tag;
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('taggables', function (Blueprint $table) {
$table->foreignIdFor(Tag::class);
$table->morphs('taggable');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('taggables');
}
};
@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddVisibleToCameraWebTable extends Migration
{
public function up()
{
Schema::table('camera_web', function (Blueprint $table) {
$table->boolean('visible')->default(true);
});
}
public function down()
{
Schema::table('camera_web', function (Blueprint $table) {
$table->dropColumn('visible');
});
}
}
@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateSubjectIdColumnInActivityLogTable extends Migration
{
public function up()
{
Schema::table('activity_log', function (Blueprint $table) {
$table->string('subject_id')->change();
});
}
public function down()
{
Schema::table('activity_log', function (Blueprint $table) {
$table->integer('subject_id')->change();
});
}
}
@@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateWebsiteBadgesTable extends Migration
{
public function up()
{
Schema::create('website_badges', function (Blueprint $table) {
$table->id();
$table->string('badge_key')->unique(); // e.g., badge_desc_14X12
$table->string('badge_name'); // e.g., 14X12
$table->text('badge_description'); // e.g., "Ohh palmboom, ohhh palmboom, wat zijn je takken wonderschoon!"
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('website_badges');
}
}
@@ -0,0 +1,22 @@
<?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('website_ads', function (Blueprint $table) {
$table->id();
$table->string('image');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('website_ads');
}
};
@@ -0,0 +1,35 @@
<?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('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration');
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};
@@ -0,0 +1,54 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('website_drawbadges', function (Blueprint $table) {
$table->id();
$table->integer('user_id');
$table->string('badge_path');
$table->string('badge_url');
$table->string('badge_name');
$table->string('badge_desc');
$table->boolean('published')->default(false);
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
});
DB::table('website_settings')->insert([
[
'key' => 'drawbadge_currency_value',
'value' => '150',
'comment' => 'Adjust here the amount that is required for buying a custom badge',
],
[
'key' => 'drawbadge_currency_type',
'value' => 'credits',
'comment' => 'Adjust here the currency type (credits, duckets, diamonds, points)',
],
]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('website_drawbadges');
DB::table('website_settings')->whereIn('key', [
'drawbadge_currency_value',
'drawbadge_currency_type',
])->delete();
}
};
@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
public function up(): void
{
DB::table('website_settings')->updateOrInsert(
['key' => 'catalog_icons_path'],
[
'value' => '/gamedata/c_images/catalogue',
'comment' => 'Path to catalog icons',
],
);
}
public function down(): void
{
DB::table('website_settings')->whereIn('key', [
'catalog_icons_path',
])->delete();
}
};
@@ -0,0 +1,27 @@
<?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::table('website_open_positions', function (Blueprint $table) {
$table->string('position_kind')->default('rank')->after('id');
$table->unsignedBigInteger('team_id')->nullable()->after('permission_id');
$table->unique('permission_id', 'open_positions_unique_permission_id');
$table->unique('team_id', 'open_positions_unique_team_id');
});
}
public function down(): void
{
Schema::table('website_open_positions', function (Blueprint $table) {
$table->dropUnique('open_positions_unique_permission_id');
$table->dropUnique('open_positions_unique_team_id');
$table->dropColumn(['position_kind', 'team_id']);
});
}
};
@@ -0,0 +1,17 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
public function up(): void
{
DB::statement('ALTER TABLE website_open_positions MODIFY description TEXT NOT NULL');
}
public function down(): void
{
DB::statement('ALTER TABLE website_open_positions MODIFY description VARCHAR(255) NOT NULL');
}
};
@@ -0,0 +1,81 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('website_staff_applications', function (Blueprint $table) {
if (! Schema::hasColumn('website_staff_applications', 'team_id')) {
$table->unsignedBigInteger('team_id')->nullable()->after('rank_id');
}
});
DB::statement('ALTER TABLE website_staff_applications MODIFY rank_id INT(11) NULL');
if (! $this->foreignKeyExists('website_staff_applications', 'website_staff_applications_team_id_foreign')) {
Schema::table('website_staff_applications', function (Blueprint $table) {
$table->foreign('team_id', 'website_staff_applications_team_id_foreign')
->references('id')->on('website_teams')
->nullOnDelete();
});
}
if (! $this->indexExists('website_staff_applications', 'website_staff_applications_user_team_unique')) {
Schema::table('website_staff_applications', function (Blueprint $table) {
$table->unique(['user_id', 'team_id'], 'website_staff_applications_user_team_unique');
});
}
}
public function down(): void
{
if ($this->indexExists('website_staff_applications', 'website_staff_applications_user_team_unique')) {
Schema::table('website_staff_applications', function (Blueprint $table) {
$table->dropUnique('website_staff_applications_user_team_unique');
});
}
if ($this->foreignKeyExists('website_staff_applications', 'website_staff_applications_team_id_foreign')) {
Schema::table('website_staff_applications', function (Blueprint $table) {
$table->dropForeign('website_staff_applications_team_id_foreign');
});
}
DB::statement('ALTER TABLE website_staff_applications MODIFY rank_id INT(11) NOT NULL');
if (Schema::hasColumn('website_staff_applications', 'team_id')) {
Schema::table('website_staff_applications', function (Blueprint $table) {
$table->dropColumn('team_id');
});
}
}
private function indexExists(string $table, string $index): bool
{
$db = DB::getDatabaseName();
$row = DB::selectOne('
SELECT COUNT(*) as cnt
FROM information_schema.statistics
WHERE table_schema = ? AND table_name = ? AND index_name = ?
', [$db, $table, $index]);
return (int) ($row->cnt ?? 0) > 0;
}
private function foreignKeyExists(string $table, string $constraint): bool
{
$db = DB::getDatabaseName();
$row = DB::selectOne("
SELECT COUNT(*) as cnt
FROM information_schema.table_constraints
WHERE constraint_schema = ? AND table_name = ? AND constraint_name = ? AND constraint_type = 'FOREIGN KEY'
", [$db, $table, $constraint]);
return (int) ($row->cnt ?? 0) > 0;
}
};
@@ -0,0 +1,101 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('website_open_positions', function (Blueprint $table) {
if (! Schema::hasColumn('website_open_positions', 'position_kind')) {
$table->string('position_kind', 20)->default('rank')->after('id');
}
if (! Schema::hasColumn('website_open_positions', 'team_id')) {
$table->unsignedBigInteger('team_id')->nullable()->after('permission_id');
}
});
// description -> TEXT (no doctrine/dbal)
DB::statement('ALTER TABLE website_open_positions MODIFY description TEXT NOT NULL');
// Unique indexes (allow multiple NULLs)
if (! $this->indexExists('website_open_positions', 'open_positions_unique_permission_id')) {
Schema::table('website_open_positions', function (Blueprint $table) {
$table->unique('permission_id', 'open_positions_unique_permission_id');
});
}
if (! $this->indexExists('website_open_positions', 'open_positions_unique_team_id')) {
Schema::table('website_open_positions', function (Blueprint $table) {
$table->unique('team_id', 'open_positions_unique_team_id');
});
}
// Optional FK to teams
if (! $this->foreignKeyExists('website_open_positions', 'website_open_positions_team_id_foreign')) {
Schema::table('website_open_positions', function (Blueprint $table) {
$table->foreign('team_id', 'website_open_positions_team_id_foreign')
->references('id')->on('website_teams')
->nullOnDelete();
});
}
}
public function down(): void
{
if ($this->indexExists('website_open_positions', 'open_positions_unique_permission_id')) {
Schema::table('website_open_positions', function (Blueprint $table) {
$table->dropUnique('open_positions_unique_permission_id');
});
}
if ($this->indexExists('website_open_positions', 'open_positions_unique_team_id')) {
Schema::table('website_open_positions', function (Blueprint $table) {
$table->dropUnique('open_positions_unique_team_id');
});
}
if ($this->foreignKeyExists('website_open_positions', 'website_open_positions_team_id_foreign')) {
Schema::table('website_open_positions', function (Blueprint $table) {
$table->dropForeign('website_open_positions_team_id_foreign');
});
}
DB::statement('ALTER TABLE website_open_positions MODIFY description VARCHAR(255) NOT NULL');
Schema::table('website_open_positions', function (Blueprint $table) {
if (Schema::hasColumn('website_open_positions', 'team_id')) {
$table->dropColumn('team_id');
}
if (Schema::hasColumn('website_open_positions', 'position_kind')) {
$table->dropColumn('position_kind');
}
});
}
private function indexExists(string $table, string $index): bool
{
$db = DB::getDatabaseName();
$row = DB::selectOne('
SELECT COUNT(*) as cnt
FROM information_schema.statistics
WHERE table_schema = ? AND table_name = ? AND index_name = ?
', [$db, $table, $index]);
return (int) ($row->cnt ?? 0) > 0;
}
private function foreignKeyExists(string $table, string $constraint): bool
{
$db = DB::getDatabaseName();
$row = DB::selectOne("
SELECT COUNT(*) as cnt
FROM information_schema.table_constraints
WHERE constraint_schema = ? AND table_name = ? AND constraint_name = ? AND constraint_type = 'FOREIGN KEY'
", [$db, $table, $constraint]);
return (int) ($row->cnt ?? 0) > 0;
}
};
@@ -0,0 +1,17 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
public function up(): void
{
DB::statement('ALTER TABLE website_open_positions MODIFY permission_id INT(11) NULL');
}
public function down(): void
{
DB::statement('ALTER TABLE website_open_positions MODIFY permission_id INT(11) NOT NULL');
}
};
@@ -0,0 +1,100 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
DB::statement('ALTER TABLE website_staff_applications MODIFY rank_id INT(11) NULL');
if (! Schema::hasColumn('website_staff_applications', 'team_id')) {
DB::statement('ALTER TABLE website_staff_applications ADD team_id INT(11) NULL AFTER rank_id');
}
if (! Schema::hasColumn('website_staff_applications', 'status')) {
DB::statement("ALTER TABLE website_staff_applications ADD status VARCHAR(20) NOT NULL DEFAULT 'pending' AFTER content");
}
if (! Schema::hasColumn('website_staff_applications', 'approved_by')) {
DB::statement('ALTER TABLE website_staff_applications ADD approved_by INT UNSIGNED NULL AFTER status');
}
if (! Schema::hasColumn('website_staff_applications', 'approved_at')) {
DB::statement('ALTER TABLE website_staff_applications ADD approved_at TIMESTAMP NULL AFTER approved_by');
}
if (! Schema::hasColumn('website_staff_applications', 'rejected_by')) {
DB::statement('ALTER TABLE website_staff_applications ADD rejected_by INT UNSIGNED NULL AFTER approved_at');
}
if (! Schema::hasColumn('website_staff_applications', 'rejected_at')) {
DB::statement('ALTER TABLE website_staff_applications ADD rejected_at TIMESTAMP NULL AFTER rejected_by');
}
try {
DB::statement('ALTER TABLE website_staff_applications
ADD CONSTRAINT wsa_team_id_fk
FOREIGN KEY (team_id) REFERENCES website_teams(id)
ON DELETE SET NULL');
} catch (Throwable $e) {
}
try {
DB::statement('ALTER TABLE website_staff_applications
ADD CONSTRAINT wsa_approved_by_fk
FOREIGN KEY (approved_by) REFERENCES users(id)
ON DELETE SET NULL');
} catch (Throwable $e) {
}
try {
DB::statement('ALTER TABLE website_staff_applications
ADD CONSTRAINT wsa_rejected_by_fk
FOREIGN KEY (rejected_by) REFERENCES users(id)
ON DELETE SET NULL');
} catch (Throwable $e) {
}
try {
DB::statement('CREATE UNIQUE INDEX wsa_user_team_unique
ON website_staff_applications (user_id, team_id)');
} catch (Throwable $e) {
}
}
public function down(): void
{
try {
DB::statement('DROP INDEX wsa_user_team_unique ON website_staff_applications');
} catch (Throwable $e) {
}
foreach (['wsa_team_id_fk', 'wsa_approved_by_fk', 'wsa_rejected_by_fk'] as $fk) {
try {
DB::statement("ALTER TABLE website_staff_applications DROP FOREIGN KEY {$fk}");
} catch (Throwable $e) {
}
}
if (Schema::hasColumn('website_staff_applications', 'rejected_at')) {
DB::statement('ALTER TABLE website_staff_applications DROP COLUMN rejected_at');
}
if (Schema::hasColumn('website_staff_applications', 'rejected_by')) {
DB::statement('ALTER TABLE website_staff_applications DROP COLUMN rejected_by');
}
if (Schema::hasColumn('website_staff_applications', 'approved_at')) {
DB::statement('ALTER TABLE website_staff_applications DROP COLUMN approved_at');
}
if (Schema::hasColumn('website_staff_applications', 'approved_by')) {
DB::statement('ALTER TABLE website_staff_applications DROP COLUMN approved_by');
}
if (Schema::hasColumn('website_staff_applications', 'status')) {
DB::statement('ALTER TABLE website_staff_applications DROP COLUMN status');
}
if (Schema::hasColumn('website_staff_applications', 'team_id')) {
DB::statement('ALTER TABLE website_staff_applications DROP COLUMN team_id');
}
DB::statement('ALTER TABLE website_staff_applications MODIFY rank_id INT(11) NOT NULL');
}
};
@@ -0,0 +1,31 @@
<?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('radio_ranks', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('description')->nullable();
$table->string('badge_code')->nullable();
$table->boolean('is_active')->default(true);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('radio_ranks');
}
};
@@ -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('radio_shouts', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id');
$table->text('message');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('radio_shouts');
}
};
@@ -0,0 +1,28 @@
<?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('website_settings', function (Blueprint $table) {
//
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('website_settings', function (Blueprint $table) {
//
});
}
};
@@ -0,0 +1,41 @@
<?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('radio_applications', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id')->index();
$table->string('real_name');
$table->integer('age');
$table->text('availability'); // Wanneer kan je draaien
$table->text('experience')->nullable(); // Ervaring als DJ
$table->text('motivation'); // Waarom wil je DJ worden
$table->text('music_style')->nullable(); // Welke muziekstijl
$table->string('discord_username')->nullable(); // Discord voor contact
$table->unsignedBigInteger('rank_id')->nullable()->index();
$table->enum('status', ['pending', 'approved', 'rejected'])->default('pending');
$table->unsignedBigInteger('approved_by')->nullable()->index();
$table->timestamp('approved_at')->nullable();
$table->unsignedBigInteger('rejected_by')->nullable()->index();
$table->timestamp('rejected_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('radio_applications');
}
};
@@ -0,0 +1,34 @@
<?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('radio_schedules', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id')->index();
$table->string('day'); // monday, tuesday, etc.
$table->time('start_time');
$table->time('end_time');
$table->string('show_name')->nullable(); // Naam van de show
$table->text('description')->nullable(); // Beschrijving van de show
$table->boolean('is_active')->default(true);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('radio_schedules');
}
};
@@ -0,0 +1,33 @@
<?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('radio_banners', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id')->index(); // DJ die de banner gebruikt
$table->string('image_path'); // Pad naar de afbeelding
$table->string('title')->nullable(); // Titel van de banner
$table->text('description')->nullable(); // Beschrijving
$table->integer('sort_order')->default(0); // Volgorde
$table->boolean('is_active')->default(true);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('radio_banners');
}
};
@@ -0,0 +1,33 @@
<?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('radio_history', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id')->index(); // DJ die gedraaid heeft
$table->string('show_name')->nullable(); // Naam van de show
$table->timestamp('started_at'); // Wanneer begonnen
$table->timestamp('ended_at')->nullable(); // Wanneer gestopt
$table->integer('listeners_count')->default(0); // Aantal luisteraars
$table->text('notes')->nullable(); // Notities
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('radio_history');
}
};
@@ -0,0 +1,27 @@
<?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('radio_contests', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('radio_contests');
}
};
@@ -0,0 +1,27 @@
<?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('radio_giveaways', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('radio_giveaways');
}
};
@@ -0,0 +1,27 @@
<?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('radio_listener_points', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('radio_listener_points');
}
};
@@ -0,0 +1,27 @@
<?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('radio_song_requests', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('radio_song_requests');
}
};
@@ -0,0 +1,27 @@
<?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('radio_song_votes', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('radio_song_votes');
}
};
@@ -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::table('users', function (Blueprint $table) {
$table->integer('radio_points')->default(0)->after('credits');
$table->timestamp('radio_last_active')->nullable()->after('radio_points');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['radio_points', 'radio_last_active']);
});
}
};
@@ -0,0 +1,33 @@
<?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('radio_contests', function (Blueprint $table) {
$table->string('title');
$table->text('description')->nullable();
$table->boolean('is_active')->default(false);
$table->boolean('is_ended')->default(false);
$table->timestamp('start_date')->nullable();
$table->timestamp('end_date')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('radio_contests', function (Blueprint $table) {
$table->dropColumn(['title', 'description', 'is_active', 'is_ended', 'start_date', 'end_date']);
});
}
};
@@ -0,0 +1,32 @@
<?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('radio_giveaways', function (Blueprint $table) {
$table->string('title');
$table->text('description')->nullable();
$table->boolean('is_active')->default(false);
$table->boolean('is_ended')->default(false);
$table->timestamp('end_date')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('radio_giveaways', function (Blueprint $table) {
$table->dropColumn(['title', 'description', 'is_active', 'is_ended', 'end_date']);
});
}
};
@@ -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('radio_contests', function (Blueprint $table) {
$table->renameColumn('start_date', 'starts_at');
$table->renameColumn('end_date', 'ends_at');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('radio_contests', function (Blueprint $table) {
$table->renameColumn('starts_at', 'start_date');
$table->renameColumn('ends_at', 'end_date');
});
}
};
@@ -0,0 +1,33 @@
<?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('radio_giveaways', function (Blueprint $table) {
$table->renameColumn('end_date', 'ends_at');
$table->timestamp('starts_at')->nullable();
$table->unsignedBigInteger('winner_id')->nullable();
$table->decimal('prize_value', 10, 2)->nullable();
$table->boolean('winner_announced')->default(false);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('radio_giveaways', function (Blueprint $table) {
$table->renameColumn('ends_at', 'end_date');
$table->dropColumn(['starts_at', 'winner_id', 'prize_value', 'winner_announced']);
});
}
};
@@ -0,0 +1,31 @@
<?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('radio_contests', function (Blueprint $table) {
$table->unsignedBigInteger('winner_id')->nullable();
$table->boolean('winners_announced')->default(false);
$table->text('prize_description')->nullable();
$table->decimal('prize_value', 10, 2)->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('radio_contests', function (Blueprint $table) {
$table->dropColumn(['winner_id', 'winners_announced', 'prize_description', 'prize_value']);
});
}
};
@@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
public function up(): void
{
DB::statement('ALTER TABLE website_settings MODIFY comment VARCHAR(255) NULL DEFAULT NULL');
}
public function down(): void
{
DB::statement("ALTER TABLE website_settings MODIFY comment VARCHAR(255) NOT NULL DEFAULT ''");
}
};

Some files were not shown because too many files have changed in this diff Show More