hyperf-chat/migrations/2020_11_04_153251_create_ar...

46 lines
1.8 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;
class CreateArticleAnnexTable extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('article_annex', function (Blueprint $table) {
$table->unsignedBigInteger('id', true)->comment('文件ID');
$table->unsignedInteger('user_id')->unsigned()->comment('上传文件的用户ID');
$table->unsignedInteger('article_id')->default(0)->comment('笔记ID');
2022-01-23 15:13:58 +08:00
$table->unsignedInteger('drive')->unsigned()->default(1)->comment('文件驱动[1:local;2:cos;]');
2022-01-21 22:19:42 +08:00
$table->string('suffix', 10)->default('')->comment('文件后缀名');
$table->unsignedBigInteger('size')->default(0)->comment('文件大小(单位字节)');
$table->string('path', 500)->nullable(false)->default('')->comment('文件保存地址(相对地址)');
2021-07-08 19:09:06 +08:00
$table->string('original_name', 100)->nullable(false)->default('')->comment('原文件名');
$table->unsignedTinyInteger('status')->default(1)->comment('附件状态[1:正常;2:已删除]');
2022-01-21 22:19:42 +08:00
$table->dateTime('created_at')->nullable(true)->comment('创建时间');
$table->dateTime('updated_at')->nullable(true)->comment('更新时间');
$table->dateTime('deleted_at')->nullable(true)->comment('删除时间');
2020-11-04 16:47:17 +08:00
2021-07-08 19:09:06 +08:00
$table->charset = 'utf8';
2020-11-04 16:47:17 +08:00
$table->collation = 'utf8_general_ci';
2021-07-08 19:09:06 +08:00
$table->engine = 'InnoDB';
2020-11-04 16:47:17 +08:00
$table->index(['user_id', 'article_id'], 'idx_user_id_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_annex');
}
}