Pagebuilder DB Migrations
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (push) Waiting to run

This commit is contained in:
Helge-Mikael Nordgård 2025-05-05 15:06:44 +02:00
parent b6ab703b4c
commit 2b5b1c43d7
2 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,35 @@
<?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::create('pages', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->onDelete('cascade');
$table->string('uuid')->unique();
$table->string('title');
$table->string('slug');
$table->json('content');
$table->boolean('is_published')->default(false);
$table->boolean('main')->default(false);
$table->boolean('linked')->default(false);
$table->integer('linkorder')->default(0);
$table->enum('visibility', ['public', 'private'])->default('public');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void {
Schema::dropIfExists('pages');
}
};

View File

@ -0,0 +1,34 @@
<?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::create('page_revisions', function (Blueprint $table) {
$table->id();
$table->foreignId('page_id')->constrained()->onDelete('cascade');
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
$table->string('uuid')->unique();
$table->unsignedInteger('version');
$table->json('content');
$table->string('title');
$table->string('slug');
$table->enum('label', ['auto-save', 'manual-save', 'published', 'restored'])->default('manual-save');
$table->boolean('active')->default(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void {
Schema::dropIfExists('page_revisions');
}
};