feat: add theme

This commit is contained in:
2026-06-14 15:06:11 +03:30
parent fb17f4c08b
commit b1e39dfabf
8 changed files with 258 additions and 7 deletions
@@ -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('themes', function (Blueprint $table) {
$table->id();
$table->string('key')->unique(); // blue, pink, green, orange, purple
$table->string('name'); // display label
$table->json('colors'); // full color map (json works on MySQL & Postgres)
$table->integer('order')->default(0);
$table->boolean('is_active')->default(true);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('themes');
}
};
@@ -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('scenes', function (Blueprint $table) {
$table->foreignId('theme_id')->nullable()->after('id')
->constrained('themes')->nullOnDelete();
});
}
public function down(): void
{
Schema::table('scenes', function (Blueprint $table) {
$table->dropForeign(['theme_id']);
$table->dropColumn('theme_id');
});
}
};