fixed demophotosseeder

This commit is contained in:
2025-09-18 09:05:29 +02:00
parent 0ad4b7d20b
commit 60f5e46ea9
3 changed files with 53 additions and 14 deletions

View File

@@ -12,7 +12,9 @@ return new class extends Migration
public function up(): void
{
Schema::table('photos', function (Blueprint $table) {
//
$table->unsignedBigInteger('tenant_id')->nullable()->after('event_id');
$table->foreign('tenant_id')->references('id')->on('tenants');
$table->index('tenant_id');
});
}
@@ -22,7 +24,8 @@ return new class extends Migration
public function down(): void
{
Schema::table('photos', function (Blueprint $table) {
//
$table->dropForeign(['tenant_id']);
$table->dropColumn('tenant_id');
});
}
};

View File

@@ -0,0 +1,31 @@
<?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('photos', function (Blueprint $table) {
$table->unsignedBigInteger('tenant_id')->nullable()->after('event_id');
$table->foreign('tenant_id')->references('id')->on('tenants')->onDelete('cascade');
$table->index('tenant_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('photos', function (Blueprint $table) {
$table->dropForeign(['tenant_id']);
$table->dropColumn('tenant_id');
});
}
};