Implement catalog CRUD overhaul, snapshot fallback activation, and billing/UX hardening

This commit is contained in:
Dwindi Ramadhana
2026-02-17 00:03:35 +07:00
parent e6aef31dd1
commit 2726b6c312
37 changed files with 2936 additions and 204 deletions

View File

@@ -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::table('user_keywords', function (Blueprint $table): void {
$table->boolean('is_active')->default(true)->after('lang');
$table->index(['user_id', 'is_active']);
});
}
public function down(): void
{
Schema::table('user_keywords', function (Blueprint $table): void {
$table->dropIndex(['user_id', 'is_active']);
$table->dropColumn('is_active');
});
}
};

View File

@@ -0,0 +1,45 @@
<?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
{
if (!Schema::hasTable('emojis')) {
return;
}
$duplicates = DB::table('emojis')
->select('slug', DB::raw('COUNT(*) as aggregate'))
->groupBy('slug')
->havingRaw('COUNT(*) > 1')
->limit(5)
->pluck('slug')
->all();
if (!empty($duplicates)) {
throw new \RuntimeException(
'Cannot add unique index on emojis.slug because duplicate slugs exist: '.implode(', ', $duplicates)
);
}
Schema::table('emojis', function (Blueprint $table): void {
$table->unique('slug', 'emojis_slug_unique');
});
}
public function down(): void
{
if (!Schema::hasTable('emojis')) {
return;
}
Schema::table('emojis', function (Blueprint $table): void {
$table->dropUnique('emojis_slug_unique');
});
}
};