47 lines
1.6 KiB
PHP
47 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('posts', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('serp_url_id')->nullable();
|
|
$table->string('title')->nullable();
|
|
$table->string('slug')->nullable();
|
|
$table->string('main_keyword')->nullable();
|
|
$table->json('keywords')->nullable();
|
|
$table->mediumText('bites')->nullable();
|
|
$table->mediumText('society_impact')->nullable();
|
|
$table->enum('society_impact_level', ['low', 'medium', 'high'])->default('low');
|
|
$table->string('image_ref_url')->nullable();
|
|
$table->foreignId('author_id')->nullable();
|
|
$table->mediumText('featured_image')->nullable();
|
|
$table->text('body')->nullable();
|
|
$table->json('metadata')->nullable();
|
|
$table->integer('views_count')->default(0);
|
|
$table->enum('status', ['publish', 'future', 'draft', 'private', 'trash'])->default('draft');
|
|
$table->timestamp('published_at')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->foreign('author_id')->references('id')->on('authors');
|
|
$table->foreign('serp_url_id')->references('id')->on('serp_urls');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('posts');
|
|
}
|
|
};
|