id(); $table->foreignId('user_id')->constrained()->cascadeOnDelete(); $table->string('type', 10); // sell | give | search | swap $table->string('category', 30); $table->string('title', 120); $table->text('description'); $table->unsignedInteger('price_cents')->nullable(); $table->boolean('negotiable')->default(false); $table->string('location', 120)->nullable(); $table->string('phone', 40)->nullable(); // pending | active | rejected | done | expired $table->string('status', 10)->default('pending'); $table->boolean('reserved')->default(false); $table->string('review_note', 500)->nullable(); $table->foreignId('reviewed_by')->nullable()->constrained('users')->nullOnDelete(); $table->timestamp('published_at')->nullable(); $table->timestamp('expires_at')->nullable(); $table->timestamp('reminded_at')->nullable(); $table->timestamps(); $table->index(['status', 'published_at']); $table->index(['user_id', 'status']); }); Schema::create('kleinanzeigen_images', function (Blueprint $table) { $table->id(); $table->foreignId('listing_id')->constrained('kleinanzeigen_listings')->cascadeOnDelete(); $table->string('path', 300); $table->string('thumb_path', 300); $table->unsignedInteger('width')->nullable(); $table->unsignedInteger('height')->nullable(); $table->unsignedSmallInteger('sort')->default(0); }); Schema::create('kleinanzeigen_favorites', function (Blueprint $table) { $table->foreignId('listing_id')->constrained('kleinanzeigen_listings')->cascadeOnDelete(); $table->foreignId('user_id')->constrained()->cascadeOnDelete(); $table->timestamp('created_at')->nullable(); $table->primary(['listing_id', 'user_id']); }); Schema::create('kleinanzeigen_reports', function (Blueprint $table) { $table->id(); $table->foreignId('listing_id')->constrained('kleinanzeigen_listings')->cascadeOnDelete(); $table->foreignId('user_id')->constrained()->cascadeOnDelete(); $table->string('reason', 500); $table->timestamp('resolved_at')->nullable(); $table->timestamps(); $table->unique(['listing_id', 'user_id']); }); } public function down(): void { foreach (['kleinanzeigen_reports', 'kleinanzeigen_favorites', 'kleinanzeigen_images', 'kleinanzeigen_listings'] as $table) { Schema::dropIfExists($table); } } };