From 16017a46c0c6d5686526bd8eaa407ebf6c9f4512 Mon Sep 17 00:00:00 2001 From: Irfan Date: Thu, 24 Feb 2022 05:24:08 +0500 Subject: [PATCH] update migrations --- .../2020_05_21_051725_create_index.php | 12 ++ ...20_07_10_182531_create_magazines_table.php | 7 + .../2020_07_11_120833_create_clubs_table.php | 7 + ...20_07_11_121125_create_producers_table.php | 7 + ...020_07_11_124330_create_profiles_table.php | 38 ---- ...01_16_105532_create_genres_anime_table.php | 28 +++ ...01_16_105536_create_genres_manga_table.php | 28 +++ ...2022_02_24_045528_create_caching_table.php | 166 ------------------ .../2022_02_24_051342_create_users_table.php | 1 + 9 files changed, 90 insertions(+), 204 deletions(-) delete mode 100644 database/migrations/2020_07_11_124330_create_profiles_table.php delete mode 100644 database/migrations/2022_02_24_045528_create_caching_table.php diff --git a/database/migrations/2020_05_21_051725_create_index.php b/database/migrations/2020_05_21_051725_create_index.php index 2e74ace..eec9e2b 100644 --- a/database/migrations/2020_05_21_051725_create_index.php +++ b/database/migrations/2020_05_21_051725_create_index.php @@ -43,6 +43,18 @@ class CreateIndex extends Migration */ public function down() { + $mappings = config('controller'); + $mapped = []; + foreach ($mappings as $controller) { + $table = $controller['table_name']; + if (in_array($table, $mapped) || in_array($table, self::IGNORE) || Schema::hasTable($table)) { + continue; + } + + Schema::dropIfExists($table); + + $mapped[] = $table; + } } } diff --git a/database/migrations/2020_07_10_182531_create_magazines_table.php b/database/migrations/2020_07_10_182531_create_magazines_table.php index 5cb196b..8b57da7 100644 --- a/database/migrations/2020_07_10_182531_create_magazines_table.php +++ b/database/migrations/2020_07_10_182531_create_magazines_table.php @@ -18,6 +18,13 @@ class CreateMagazinesTable extends Migration $table->unique(['mal_id' => 1], 'mal_id'); $table->index('count', 'count'); $table->index('name', 'name'); + + $table->index( + [ + 'name' => 'text' + ], + 'search' + ); }); } diff --git a/database/migrations/2020_07_11_120833_create_clubs_table.php b/database/migrations/2020_07_11_120833_create_clubs_table.php index a8739ea..630a21e 100644 --- a/database/migrations/2020_07_11_120833_create_clubs_table.php +++ b/database/migrations/2020_07_11_120833_create_clubs_table.php @@ -21,6 +21,13 @@ class CreateClubsTable extends Migration $table->index('category'); $table->date('created')->index(); $table->index('access'); + + $table->index( + [ + 'name' => 'text' + ], + 'search' + ); }); } diff --git a/database/migrations/2020_07_11_121125_create_producers_table.php b/database/migrations/2020_07_11_121125_create_producers_table.php index da219e2..2882d0d 100644 --- a/database/migrations/2020_07_11_121125_create_producers_table.php +++ b/database/migrations/2020_07_11_121125_create_producers_table.php @@ -17,6 +17,13 @@ class CreateProducersTable extends Migration $table->unique(['mal_id' => 1], 'mal_id'); $table->index('count', 'count'); $table->index('name', 'name'); + + $table->index( + [ + 'name' => 'text' + ], + 'search' + ); }); } diff --git a/database/migrations/2020_07_11_124330_create_profiles_table.php b/database/migrations/2020_07_11_124330_create_profiles_table.php deleted file mode 100644 index dde22cc..0000000 --- a/database/migrations/2020_07_11_124330_create_profiles_table.php +++ /dev/null @@ -1,38 +0,0 @@ -string('request_hash'); - $table->unique(['mal_id' => 1], 'mal_id'); - $table->unique(['username' => 1], 'username'); - $table->date('last_online')->index(); - $table->index('gender'); - $table->date('birthday')->index(); - $table->index('location'); - $table->date('joined')->index(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('users'); - } -} diff --git a/database/migrations/2021_01_16_105532_create_genres_anime_table.php b/database/migrations/2021_01_16_105532_create_genres_anime_table.php index 641f6a9..85743b4 100644 --- a/database/migrations/2021_01_16_105532_create_genres_anime_table.php +++ b/database/migrations/2021_01_16_105532_create_genres_anime_table.php @@ -17,24 +17,52 @@ class CreateGenresAnimeTable extends Migration $table->unique(['mal_id' => 1], 'mal_id'); $table->index('count', 'count'); $table->index('name', 'name'); + + $table->index( + [ + 'name' => 'text' + ], + 'search' + ); }); Schema::create('demographics_anime', function (Blueprint $table) { $table->unique(['mal_id' => 1], 'mal_id'); $table->index('count', 'count'); $table->index('name', 'name'); + + $table->index( + [ + 'name' => 'text' + ], + 'search' + ); }); Schema::create('explicit_genres_anime', function (Blueprint $table) { $table->unique(['mal_id' => 1], 'mal_id'); $table->index('count', 'count'); $table->index('name', 'name'); + + $table->index( + [ + 'name' => 'text' + ], + 'search' + ); }); Schema::create('themes_anime', function (Blueprint $table) { $table->unique(['mal_id' => 1], 'mal_id'); $table->index('count', 'count'); $table->index('name', 'name'); + + $table->index( + [ + 'name' => 'text' + ], + 'search' + ); }); } diff --git a/database/migrations/2021_01_16_105536_create_genres_manga_table.php b/database/migrations/2021_01_16_105536_create_genres_manga_table.php index caecad6..43c4592 100644 --- a/database/migrations/2021_01_16_105536_create_genres_manga_table.php +++ b/database/migrations/2021_01_16_105536_create_genres_manga_table.php @@ -17,24 +17,52 @@ class CreateGenresMangaTable extends Migration $table->unique(['mal_id' => 1], 'mal_id'); $table->index('count', 'count'); $table->index('name', 'name'); + + $table->index( + [ + 'name' => 'text' + ], + 'search' + ); }); Schema::create('explicit_genres_manga', function (Blueprint $table) { $table->unique(['mal_id' => 1], 'mal_id'); $table->index('count', 'count'); $table->index('name', 'name'); + + $table->index( + [ + 'name' => 'text' + ], + 'search' + ); }); Schema::create('demographics_manga', function (Blueprint $table) { $table->unique(['mal_id' => 1], 'mal_id'); $table->index('count', 'count'); $table->index('name', 'name'); + + $table->index( + [ + 'name' => 'text' + ], + 'search' + ); }); Schema::create('themes_manga', function (Blueprint $table) { $table->unique(['mal_id' => 1], 'mal_id'); $table->index('count', 'count'); $table->index('name', 'name'); + + $table->index( + [ + 'name' => 'text' + ], + 'search' + ); }); } diff --git a/database/migrations/2022_02_24_045528_create_caching_table.php b/database/migrations/2022_02_24_045528_create_caching_table.php deleted file mode 100644 index 89fc3d9..0000000 --- a/database/migrations/2022_02_24_045528_create_caching_table.php +++ /dev/null @@ -1,166 +0,0 @@ -index('request_hash', 'request_hash'); - }); - Schema::create('anime_episode', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('anime_episodes', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('anime_forum', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('anime_moreinfo', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('anime_news', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('anime_pictures', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('anime_recommendations', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('anime_reviews', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('anime_stats', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('anime_userupdates', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('anime_videos', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('characters_pictures', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('clubs_members', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('common', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('manga_characters', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('manga_moreinfo', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('manga_news', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('manga_pictures', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('manga_recommendations', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('manga_reviews', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('manga_stats', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('manga_userupdates', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('people_pictures', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('recommendations', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('reviews', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('users_animelist', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('users_mangalist', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('users_clubs', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('users_friends', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('users_history', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('users_recently_online', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('users_recommendations', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('users_reviews', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - Schema::create('watch', function (Blueprint $table) { - $table->index('request_hash', 'request_hash'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('anime_characters_staff'); - Schema::dropIfExists('anime_episode'); - Schema::dropIfExists('anime_episodes'); - Schema::dropIfExists('anime_forum'); - Schema::dropIfExists('anime_moreinfo'); - Schema::dropIfExists('anime_news'); - Schema::dropIfExists('anime_pictures'); - Schema::dropIfExists('anime_recommendations'); - Schema::dropIfExists('anime_reviews'); - Schema::dropIfExists('anime_stats'); - Schema::dropIfExists('anime_userupdates'); - Schema::dropIfExists('anime_videos'); - Schema::dropIfExists('characters_pictures'); - Schema::dropIfExists('clubs_members'); - Schema::dropIfExists('common'); - Schema::dropIfExists('manga_characters'); - Schema::dropIfExists('manga_moreinfo'); - Schema::dropIfExists('manga_news'); - Schema::dropIfExists('manga_pictures'); - Schema::dropIfExists('manga_recommendations'); - Schema::dropIfExists('manga_reviews'); - Schema::dropIfExists('manga_stats'); - Schema::dropIfExists('manga_userupdates'); - Schema::dropIfExists('people_pictures'); - Schema::dropIfExists('recommendations'); - Schema::dropIfExists('reviews'); - Schema::dropIfExists('users_animelist'); - Schema::dropIfExists('users_mangalist'); - Schema::dropIfExists('users_clubs'); - Schema::dropIfExists('users_friends'); - Schema::dropIfExists('users_history'); - Schema::dropIfExists('users_recently_online'); - Schema::dropIfExists('users_recommendations'); - Schema::dropIfExists('users_reviews'); - Schema::dropIfExists('watch'); - } -} diff --git a/database/migrations/2022_02_24_051342_create_users_table.php b/database/migrations/2022_02_24_051342_create_users_table.php index 6fd5ae4..c1d789b 100644 --- a/database/migrations/2022_02_24_051342_create_users_table.php +++ b/database/migrations/2022_02_24_051342_create_users_table.php @@ -15,6 +15,7 @@ class CreateUsersTable extends Migration { Schema::create('users', function (Blueprint $table) { $table->unique(['request_hash' => 1], 'request_hash'); + $table->unique(['mal_id' => 1], 'mal_id'); $table->unique(['internal_username' => 1], 'internal_username'); $table->date('joined')->index('joined');