feat: add detail image media and play list

This commit is contained in:
2026-06-06 19:08:27 +03:30
parent 0b578e15dd
commit fcf9c35697
5 changed files with 91 additions and 10 deletions
@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Add a second image reference: image_id = list/thumbnail image,
* detail_image_id = image shown on the detail (show-by-id) screen.
*/
public function up(): void
{
Schema::table('media', function (Blueprint $table) {
$table->unsignedBigInteger('detail_image_id')->nullable()->after('image_id');
$table->foreign('detail_image_id')->references('id')->on('images')->nullOnDelete();
});
Schema::table('music_playlists', function (Blueprint $table) {
$table->unsignedBigInteger('detail_image_id')->nullable()->after('image_id');
$table->foreign('detail_image_id')->references('id')->on('images')->nullOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('media', function (Blueprint $table) {
$table->dropForeign(['detail_image_id']);
$table->dropColumn('detail_image_id');
});
Schema::table('music_playlists', function (Blueprint $table) {
$table->dropForeign(['detail_image_id']);
$table->dropColumn('detail_image_id');
});
}
};