57 lines
1.6 KiB
PHP
57 lines
1.6 KiB
PHP
<?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('contents', function (Blueprint $table) {
|
|
$table->id();
|
|
|
|
$table->enum('type', \App\Enums\ContentType::cases());
|
|
|
|
$table->string('title');
|
|
$table->string('slug')->unique();
|
|
$table->text('excerpt')->nullable();
|
|
$table->longText('content')->nullable();
|
|
|
|
$table->json('taxonomies')->nullable();
|
|
|
|
$table->string('meta_title')->nullable();
|
|
$table->text('meta_description')->nullable();
|
|
$table->json('meta_keywords')->nullable();
|
|
|
|
$table->enum('status', \App\Enums\ContentStatus::cases());
|
|
|
|
$table->foreignId('featured_image_id')->nullable()->constrained('media');
|
|
|
|
$table->timestamp('published_at')->nullable();
|
|
|
|
$table->foreignId('created_by')->nullable()->constrained('users');
|
|
$table->foreignId('updated_by')->nullable()->constrained('users');
|
|
$table->foreignId('deleted_by')->nullable()->constrained('users');
|
|
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
|
|
$table->index('type');
|
|
$table->index('status');
|
|
$table->index('published_at');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('contents');
|
|
}
|
|
};
|