feat: add breath colors

This commit is contained in:
2026-06-16 18:52:25 +03:30
parent 81ac4a896f
commit 42f3808343
9 changed files with 206 additions and 8 deletions
@@ -0,0 +1,23 @@
<?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('breathing_templates', function (Blueprint $table) {
// One or more hex colors: a single solid color or a gradient.
$table->json('colors')->nullable()->after('image_id');
});
}
public function down(): void
{
Schema::table('breathing_templates', function (Blueprint $table) {
$table->dropColumn('colors');
});
}
};
@@ -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::create('breathing_colors', function (Blueprint $table) {
$table->id();
$table->string('name')->nullable();
$table->json('colors'); // one hex (solid) or several (gradient)
$table->integer('order')->default(0);
$table->boolean('is_active')->default(true);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('breathing_colors');
}
};
@@ -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::table('breathing_templates', function (Blueprint $table) {
if (Schema::hasColumn('breathing_templates', 'colors')) {
$table->dropColumn('colors');
}
$table->foreignId('breathing_color_id')->nullable()->after('image_id')
->constrained('breathing_colors')->nullOnDelete();
});
}
public function down(): void
{
Schema::table('breathing_templates', function (Blueprint $table) {
$table->dropForeign(['breathing_color_id']);
$table->dropColumn('breathing_color_id');
$table->json('colors')->nullable();
});
}
};