1
0
Fork 0
internet-everythings-agricu.../database/migrations/2023_03_20_114120_create_ar...

45 lines
1.4 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.
*
* @return void
*/
public function up()
{
Schema::create('articles', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->string('sub_title')->nullable()->comment('副标题');
$table->unsignedBigInteger('category_id')->nullable()->comment('文章分类');
$table->text('content')->nullable()->comment('文章内容');
$table->timestamp('published_at')->nullable()->comment('发布时间');
$table->unsignedTinyInteger('is_recommend')->default(0)->comment('推荐开关');
$table->unsignedTinyInteger('is_enable')->default(1)->comment('显示开关');
$table->unsignedInteger('sort')->default(0)->comment('排序');
// 可能用到的额外字段
$table->string('cover')->nullable()->comment('封面');
$table->string('author')->nullable()->comment('作者/来源');
$table->string('category_path')->nullable()->comment('所有分类id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('articles');
}
};