feat: add image_id for template

This commit is contained in:
2025-09-26 12:13:38 +03:30
parent 535e73c4c9
commit 8ca4085b86
4 changed files with 78 additions and 21 deletions
@@ -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('breathing_templates', function (Blueprint $table) {
$table->unsignedBigInteger('image_id')->nullable()->after('description');
$table->foreign('image_id')->references('id')->on('images')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('breathing_templates', function (Blueprint $table) {
$table->dropForeign(['image_id']);
$table->dropColumn('image_id');
});
}
};