Files
laraundfelix/database/migrations/2026_11_15_100000_create_cms_tables.php
T
LarsandCursor 2035c46edd
Deploy Test / test (push) Successful in 2m25s
Deploy Test / deploy (push) Failing after 25s
Stelle das U0-Fundament mit CMS, Mitgliedern und Filament bereit.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-15 08:32:14 +01:00

59 lines
2.0 KiB
PHP

<?php
use Database\Seeders\CmsSeeder;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('pages', function (Blueprint $table) {
$table->id();
$table->string('path')->unique();
$table->unsignedBigInteger('published_revision_id')->nullable();
$table->timestamps();
});
Schema::create('page_revisions', function (Blueprint $table) {
$table->id();
$table->foreignId('page_id')->constrained()->cascadeOnDelete();
$table->json('blocks');
$table->string('seo_title')->nullable();
$table->string('seo_description', 500)->nullable();
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
$table->timestamp('created_at')->useCurrent();
});
Schema::table('pages', function (Blueprint $table) {
$table->foreign('published_revision_id')
->references('id')
->on('page_revisions')
->nullOnDelete();
});
Schema::create('navigation_items', function (Blueprint $table) {
$table->id();
$table->string('label');
$table->foreignId('page_id')->nullable()->constrained()->nullOnDelete();
$table->string('url')->nullable();
$table->string('placement')->default('header');
$table->unsignedInteger('sort_order')->default(0);
$table->timestamps();
});
(new CmsSeeder)->run();
}
public function down(): void
{
Schema::dropIfExists('navigation_items');
Schema::table('pages', function (Blueprint $table) {
$table->dropForeign(['published_revision_id']);
});
Schema::dropIfExists('page_revisions');
Schema::dropIfExists('pages');
}
};