bigIncrements('id'); $table->unsignedBigInteger('mal_id')->default(0); $table->unsignedBigInteger('user_id')->default(0); $table->string('username')->default(''); $table->timestamp('airing_at'); $table->integer('duration')->default('20'); $table->integer('episode')->default(0); $table->integer('episodes_watched')->default(0)->nullable(); $table->integer('episodes_complete')->default(0)->nullable(); $table->float('score')->default(0)->nullable(); $table->integer('score_user')->default(0)->nullable(); $table->string('mal_url')->default(''); $table->string('title')->default(''); $table->foreign('mal_id')->references('mal_id')->on('anime'); $table->foreign('user_id')->references('id')->on('malusers'); $table->unique(['mal_id', 'user_id', 'airing_at']); $table->unique(['mal_id', 'user_id', 'episode']); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('calendar'); } }