diff options
| author | horus | 2020-02-24 02:47:52 +0100 |
|---|---|---|
| committer | horus | 2020-02-24 02:47:52 +0100 |
| commit | 420e44e0fe4623a439e26dfd0526ee5ef606a170 (patch) | |
| tree | 1669604f8db3382da7f9e2fb0e492013a04eb839 /database | |
| parent | b6e4ea17a3a6dce208c30418a7a3a898b83d6938 (diff) | |
| download | senpai-420e44e0fe4623a439e26dfd0526ee5ef606a170.tar.gz | |
Crude workaround.
Diffstat (limited to 'database')
3 files changed, 137 insertions, 0 deletions
diff --git a/database/migrations/2020_02_23_235746_create_anime_table.php b/database/migrations/2020_02_23_235746_create_anime_table.php new file mode 100644 index 0000000..985812e --- /dev/null +++ b/database/migrations/2020_02_23_235746_create_anime_table.php @@ -0,0 +1,44 @@ +<?php + +use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; + +class CreateAnimeTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('anime', function (Blueprint $table) { + $table->bigIncrements('id'); + + $table->unsignedBigInteger('mal_id')->unique()->default('0'); + + $table->string('url')->default(''); + $table->string('image_url')->default(''); + + $table->string('title_eng')->default(''); + $table->string('title_rom')->default(''); + $table->string('title_nat')->default(''); + $table->string('title_pref')->default(''); + + $table->string('type')->default(''); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('anime'); + } +} diff --git a/database/migrations/2020_02_23_235949_create_stats_table.php b/database/migrations/2020_02_23_235949_create_stats_table.php new file mode 100644 index 0000000..142374c --- /dev/null +++ b/database/migrations/2020_02_23_235949_create_stats_table.php @@ -0,0 +1,61 @@ +<?php + +use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; + +class CreateStatsTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('stats', function (Blueprint $table) { + $table->bigIncrements('id'); + + $table->unsignedBigInteger('mal_id')->default(0); + + $table->string('season_name')->default(''); + $table->integer('season_year')->default(0); + + $table->float('score')->default(0); + $table->integer('scored_by')->default(0); + $table->integer('rank')->default(0); + $table->integer('popularity')->default(0); + $table->integer('members')->default(0); + $table->integer('favorites')->default(0); + + $table->integer('watching')->default(0); + $table->integer('completed')->default(0); + $table->integer('onhold')->default(0); + $table->integer('dropped')->default(0); + $table->integer('plan_to_watch')->default(0); + + $table->integer('score_1')->default(0); + $table->integer('score_2')->default(0); + $table->integer('score_3')->default(0); + $table->integer('score_4')->default(0); + $table->integer('score_5')->default(0); + $table->integer('score_6')->default(0); + $table->integer('score_7')->default(0); + $table->integer('score_8')->default(0); + $table->integer('score_9')->default(0); + $table->integer('score_10')->default(0); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('stats'); + } +} diff --git a/database/migrations/2020_02_24_005015_add_fk_stats.php b/database/migrations/2020_02_24_005015_add_fk_stats.php new file mode 100644 index 0000000..3a6a66a --- /dev/null +++ b/database/migrations/2020_02_24_005015_add_fk_stats.php @@ -0,0 +1,32 @@ +<?php + +use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; + +class AddFkStats extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::table('stats', function (Blueprint $table) { + $table->foreign('mal_id')->references('mal_id')->on('anime'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('stats', function (Blueprint $table) { + // + }); + } +} |
