Edit File: 2024_09_12_061955_create_animes_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. */ public function up(): void { Schema::create('animes', function (Blueprint $table) { $table->id(); $table->string('title', 255)->unique(); $table->string('name', 100); $table->text('short_description'); $table->string('thumbnail', 255); $table->string('release_date', 255)->nullable()->default('-'); $table->string('nation', 255)->nullable()->default('-'); $table->string('score', 255)->nullable()->default("0.00 / 0.00"); $table->string('current_episode', 255)->nullable()->default("1"); $table->string('total_episode', 50)->nullable()->default("-"); $table->integer('view_count')->unsigned()->nullable()->default(0); $table->integer('view_daily')->unsigned()->nullable()->default(0); $table->boolean('is_hot')->nullable()->default(false); $table->boolean('is_priority')->nullable()->default(false); $table->unsignedBigInteger('season_id'); $table->foreign('season_id')->references('id')->on('seasons')->onDelete('cascade'); $table->unsignedBigInteger('genre_id'); $table->foreign('genre_id')->references('id')->on('genres')->onDelete('cascade'); $table->unsignedBigInteger('type_id'); $table->foreign('type_id')->references('id')->on('types')->onDelete('cascade'); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('animes'); } };
Back