1
0
Fork 0
party-rank-server/database/migrations/2023_12_01_102243_create_ar...

50 lines
1.9 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('articles', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('category_id')->comment('分类ID');
$table->string('category_path')->default('-')->comment('分类 path');
$table->string('title')->comment('文章标题');
$table->string('key')->nullable('用于指定查询某一篇文章');
$table->string('description')->nullable()->comment('描述');
$table->string('author')->nullable()->comment('作者');
$table->string('cover')->nullable()->comment('封面');
$table->longText('content')->nullable()->comment('文章内容');
$table->json('medias')->nullable()->comment('媒体[{name,url,type}]');
$table->json('files')->nullable()->comment('附件[{name,url,type}]');
$table->timestamp('published_at')->nullable()->comment('发布时间');
$table->unsignedInteger('sort')->default(1)->comment('排序(asc)');
$table->string('remarks')->nullable()->comment('备注');
$table->unsignedTinyInteger('is_recommend')->default(0)->comment('推荐状态');
$table->unsignedTinyInteger('is_enable')->default(1)->comment('可用状态');
$table->json('extension')->nullable()->comment('扩展字段');
$table->unsignedBigInteger('party_cate_id')->nullable()->comment('党支部ID');
$table->timestamps();
$table->comment('文章');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('articles');
}
};