fixed photos+likes system migration
This commit is contained in:
@@ -9,11 +9,11 @@ return new class extends Migration
|
|||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
// Photos table
|
// Photos table
|
||||||
if (!Schema::hasTable('photos')) {
|
if (! Schema::hasTable('photos')) {
|
||||||
Schema::create('photos', function (Blueprint $table) {
|
Schema::create('photos', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->unsignedBigInteger('event_id');
|
$table->unsignedBigInteger('event_id');
|
||||||
$table->unsignedBigInteger('emotion_id');
|
$table->unsignedBigInteger('emotion_id')->nullable();
|
||||||
$table->unsignedBigInteger('task_id')->nullable();
|
$table->unsignedBigInteger('task_id')->nullable();
|
||||||
$table->string('guest_name');
|
$table->string('guest_name');
|
||||||
$table->string('file_path');
|
$table->string('file_path');
|
||||||
@@ -31,7 +31,7 @@ return new class extends Migration
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Add tenant_id if missing (consolidate duplicates)
|
// 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) {
|
Schema::table('photos', function (Blueprint $table) {
|
||||||
$table->unsignedBigInteger('tenant_id')->nullable()->after('event_id');
|
$table->unsignedBigInteger('tenant_id')->nullable()->after('event_id');
|
||||||
$table->foreign('tenant_id')->references('id')->on('tenants')->onDelete('cascade');
|
$table->foreign('tenant_id')->references('id')->on('tenants')->onDelete('cascade');
|
||||||
@@ -41,7 +41,7 @@ return new class extends Migration
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Photo Likes table
|
// Photo Likes table
|
||||||
if (!Schema::hasTable('photo_likes')) {
|
if (! Schema::hasTable('photo_likes')) {
|
||||||
Schema::create('photo_likes', function (Blueprint $table) {
|
Schema::create('photo_likes', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->unsignedBigInteger('photo_id');
|
$table->unsignedBigInteger('photo_id');
|
||||||
@@ -74,4 +74,4 @@ return new class extends Migration
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user