<?php

namespace App\Modules\Book\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class RententionBookChapterUV extends Model
{
    protected $table = 'rentention_book_chapter_uvs';

    protected $fillable = [
        'bid',
        'sequence',
        'uv',
    ];

    public static function createTable()
    {
        if (!Schema::hasTable('rentention_book_chapter_uvs')) {
            Schema::create('rentention_book_chapter_uvs', function (Blueprint $table) {
                $table->increments('id');
                $table->integer('bid');
                $table->integer('sequence');
                $table->integer('uv');
                $table->timestamps();
                $table->index(['bid', 'sequence'], 'idx_bid_sequence');
            });
        }
    }
}
