hyperf-chat/migrations/2020_11_04_153316_create_ar...

38 lines
1.1 KiB
PHP
Raw Permalink Normal View History

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) {
2022-01-21 22:19:42 +08:00
$table->unsignedInteger('id', true)->comment('自增ID');
2020-11-04 16:47:17 +08:00
$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
2022-01-21 22:19:42 +08:00
$table->unique('article_id', 'uk_article_id');
2020-11-04 16:47:17 +08:00
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');
}
}