techblog/database/migrations/2025_11_09_121518_create_posts_table.php
PeterChrz 75561faf25
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
initialize project and update gitignore
2026-03-19 09:35:42 -04:00

36 lines
975 B
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->string('title', 128);
$table->string('slug', 64);
$table->longText('content');
$table->text('excerpt');
$table->string('status', 32)->comment('draft, published, archived');
$table->dateTime('published_at')->nullable();
$table->foreignId('author_id')->nullable();
$table->foreignId('category_id')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('posts');
}
};