<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateBilibiliVideosTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('bilibili_videos', function (Blueprint $table) {
            $table->increments('id');
            $table->bigInteger("aid")->unique()->comment("B站 video 的 id");
            $table->string("title")->comment("视频标题");
            $table->unsignedTinyInteger("from_type")->comment("来源类型，1：收藏夹，2：up，3：共有");
            $table->string("from_collection_name")->comment("来源的收藏夹");
            $table->string("from_up_name")->comment("来源的 up 名字");
            $table->unsignedTinyInteger("is_download")->comment("是否要下载")->default(1);
            $table->unsignedTinyInteger("is_downloaded")->comment("是否已下载")->default(0);
            $table->unsignedTinyInteger("total_parts")->comment("总的分 P 数")->default(1);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('bilibili_videos');
    }
}
