fixed photos+likes system migration

This commit is contained in:
Codex Agent
2025-11-15 21:26:00 +01:00
parent d2fa5f943e
commit 9e707ce618

View File

@@ -9,11 +9,11 @@ return new class extends Migration
public function up(): void
{
// Photos table
if (!Schema::hasTable('photos')) {
if (! Schema::hasTable('photos')) {
Schema::create('photos', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('event_id');
$table->unsignedBigInteger('emotion_id');
$table->unsignedBigInteger('emotion_id')->nullable();
$table->unsignedBigInteger('task_id')->nullable();
$table->string('guest_name');
$table->string('file_path');
@@ -31,7 +31,7 @@ return new class extends Migration
});
} else {
// Add tenant_id if missing (consolidate duplicates)
if (!Schema::hasColumn('photos', 'tenant_id')) {
if (! Schema::hasColumn('photos', 'tenant_id')) {
Schema::table('photos', function (Blueprint $table) {
$table->unsignedBigInteger('tenant_id')->nullable()->after('event_id');
$table->foreign('tenant_id')->references('id')->on('tenants')->onDelete('cascade');
@@ -41,7 +41,7 @@ return new class extends Migration
}
// Photo Likes table
if (!Schema::hasTable('photo_likes')) {
if (! Schema::hasTable('photo_likes')) {
Schema::create('photo_likes', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('photo_id');
@@ -74,4 +74,4 @@ return new class extends Migration
}
}
}
};
};