46 lines
1.4 KiB
PHP
46 lines
1.4 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
class CreateMaterialsTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('materials', function (Blueprint $table) {
|
|
$table->bigIncrements('id');
|
|
$table->string('title')->nullable();
|
|
$table->text('desc')->nullable();
|
|
$table->unsignedInteger('view')->default(0);
|
|
$table->unsignedDecimal('rating')->default(0);
|
|
$table->unsignedDecimal('price')->nullable();
|
|
$table->unsignedDecimal('size')->nullable();
|
|
$table->unsignedInteger('duration')->nullable();
|
|
$table->json('details')->nullable();
|
|
$table->text('trailer_url')->nullable();
|
|
$table->text('content_url')->nullable();
|
|
$table->text('banner_url')->nullable();
|
|
$table->unsignedBigInteger('category_id');
|
|
$table->foreign('category_id')->references('id')->on('categories');
|
|
$table->unsignedSmallInteger('day_count')->default(0);
|
|
$table->unsignedSmallInteger('download_count')->default(0);
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('materials');
|
|
}
|
|
}
|