Pagebuilder DB Migrations
This commit is contained in:
parent
b6ab703b4c
commit
2b5b1c43d7
35
database/migrations/2025_04_05_195221_create_pages_table.php
Normal file
35
database/migrations/2025_04_05_195221_create_pages_table.php
Normal 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');
|
||||
}
|
||||
};
|
@ -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');
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user