37 lines
975 B
PHP
37 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');
|
||
|
|
}
|
||
|
|
};
|