2020-11-04 16:47:17 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Hyperf\Database\Schema\Schema;
|
|
|
|
use Hyperf\Database\Schema\Blueprint;
|
|
|
|
use Hyperf\Database\Migrations\Migration;
|
2021-08-27 23:50:40 +08:00
|
|
|
|
2020-11-04 16:47:17 +08:00
|
|
|
class CreateArticleDetailTable extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*/
|
|
|
|
public function up(): void
|
|
|
|
{
|
|
|
|
Schema::create('article_detail', function (Blueprint $table) {
|
|
|
|
$table->unsignedInteger('id', true)->comment('笔记详情ID');
|
|
|
|
$table->unsignedInteger('article_id')->nullable(false)->comment('笔记ID');
|
|
|
|
$table->longtext('md_content')->charset('utf8mb4')->comment('Markdown 内容');
|
|
|
|
$table->longtext('content')->charset('utf8mb4')->comment('Markdown 解析HTML内容');
|
|
|
|
|
2021-08-27 23:50:40 +08:00
|
|
|
$table->charset = 'utf8';
|
2020-11-04 16:47:17 +08:00
|
|
|
$table->collation = 'utf8_general_ci';
|
2021-08-27 23:50:40 +08:00
|
|
|
$table->engine = 'InnoDB';
|
2020-11-04 16:47:17 +08:00
|
|
|
|
|
|
|
$table->unique('article_id', 'unique_article_id');
|
|
|
|
|
2021-08-27 23:50:40 +08:00
|
|
|
$table->comment('笔记详情表');
|
|
|
|
});
|
2020-11-04 16:47:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*/
|
|
|
|
public function down(): void
|
|
|
|
{
|
|
|
|
Schema::dropIfExists('article_detail');
|
|
|
|
}
|
|
|
|
}
|