From 5dda561d73c9a5698386d643d56a142aa4bbdeec Mon Sep 17 00:00:00 2001 From: horus Date: Thu, 5 Mar 2020 16:02:10 +0100 Subject: Committing intermediate state. --- .../2020_03_05_162010_create_calendar.php | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 database/migrations/2020_03_05_162010_create_calendar.php (limited to 'database/migrations/2020_03_05_162010_create_calendar.php') diff --git a/database/migrations/2020_03_05_162010_create_calendar.php b/database/migrations/2020_03_05_162010_create_calendar.php new file mode 100644 index 0000000..3a6cb8f --- /dev/null +++ b/database/migrations/2020_03_05_162010_create_calendar.php @@ -0,0 +1,52 @@ +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'); + } +} -- cgit v1.2.3