Kommentare mit Antworten unter Neuigkeiten
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 4m42s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 4m33s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m41s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 5m48s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 8m0s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 8m6s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m10s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 5m19s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m21s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-26 20:13:41 +00:00
parent f3f2d23961
commit 9320d602a8
117 changed files with 1015 additions and 423 deletions

View file

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Kommentare zu Beiträgen mit Antworten (eine Ebene: Antworten hängen am Kommentar).
*/
return new class extends Migration
{
public function up(): void
{
Schema::create('news_comments', function (Blueprint $table) {
$table->id();
$table->foreignId('post_id')->constrained('news_posts')->cascadeOnDelete();
$table->foreignId('parent_id')->nullable()->constrained('news_comments')->cascadeOnDelete();
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('reply_to_user_id')->nullable()->constrained('users')->nullOnDelete();
$table->text('body');
$table->timestamp('edited_at')->nullable();
$table->timestamps();
$table->softDeletes();
$table->index(['post_id', 'parent_id', 'created_at']);
});
if (! Schema::hasColumn('news_posts', 'comments_enabled')) {
Schema::table('news_posts', fn (Blueprint $table) => $table->boolean('comments_enabled')->default(true)->after('form_id'));
}
}
public function down(): void
{
Schema::dropIfExists('news_comments');
if (Schema::hasColumn('news_posts', 'comments_enabled')) {
Schema::table('news_posts', fn (Blueprint $table) => $table->dropColumn('comments_enabled'));
}
}
};