events werden nun erfolgreich gespeichert, branding wird nun erfolgreich gespeichert, emotionen können nun angelegt werden. Task Ansicht im Event admin verbessert, Buttons in FAB umgewandelt und vereinheitlicht. Teilen-Link Guest PWA schicker gemacht, SynGoogleFonts ausgebaut (mit Einzel-Family-Download).
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('emotions') || ! Schema::hasColumn('emotions', 'tenant_id')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Treat any emotions that aren't tied to a known tenant as global
|
||||
DB::table('emotions')
|
||||
->whereNotExists(function ($query) {
|
||||
$query->selectRaw(1)
|
||||
->from('tenants')
|
||||
->whereColumn('tenants.id', 'emotions.tenant_id');
|
||||
})
|
||||
->update(['tenant_id' => null]);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
// No-op: data-only normalization cannot be safely reverted
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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('emotions') || Schema::hasColumn('emotions', 'tenant_id')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('emotions', function (Blueprint $table) {
|
||||
$table->foreignId('tenant_id')->nullable()->after('id')->constrained('tenants')->nullOnDelete();
|
||||
$table->index('tenant_id');
|
||||
});
|
||||
|
||||
// Treat all existing emotions as global by default
|
||||
DB::table('emotions')->update(['tenant_id' => null]);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (! Schema::hasTable('emotions') || ! Schema::hasColumn('emotions', 'tenant_id')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('emotions', function (Blueprint $table) {
|
||||
$table->dropForeign(['tenant_id']);
|
||||
$table->dropIndex(['tenant_id']);
|
||||
$table->dropColumn('tenant_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
<?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
|
||||
{
|
||||
if (! Schema::hasTable('emotions')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$existing = DB::table('emotions')->count();
|
||||
if ($existing > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$now = now();
|
||||
$defaults = [
|
||||
['de' => 'Liebe', 'en' => 'Love', 'color' => '#f472b6'],
|
||||
['de' => 'Freude', 'en' => 'Joy', 'color' => '#10b981'],
|
||||
['de' => 'Rührung', 'en' => 'Touched', 'color' => '#60a5fa'],
|
||||
['de' => 'Nostalgie', 'en' => 'Nostalgia', 'color' => '#a855f7'],
|
||||
['de' => 'Überraschung', 'en' => 'Surprise', 'color' => '#f59e0b'],
|
||||
];
|
||||
|
||||
$rows = [];
|
||||
foreach ($defaults as $index => $emotion) {
|
||||
$rows[] = [
|
||||
'name' => json_encode($emotion),
|
||||
'description' => json_encode([]),
|
||||
'icon' => 'lucide-smile',
|
||||
'color' => $emotion['color'],
|
||||
'sort_order' => $index,
|
||||
'is_active' => true,
|
||||
'tenant_id' => null,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
];
|
||||
}
|
||||
|
||||
DB::table('emotions')->insert($rows);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (! Schema::hasTable('emotions')) {
|
||||
return;
|
||||
}
|
||||
|
||||
DB::table('emotions')->truncate();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user