update migrations

This commit is contained in:
Irfan 2022-02-24 05:24:08 +05:00
parent 1afc7cb763
commit 16017a46c0
9 changed files with 90 additions and 204 deletions

View File

@ -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;
}
}
}

View File

@ -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'
);
});
}

View File

@ -21,6 +21,13 @@ class CreateClubsTable extends Migration
$table->index('category');
$table->date('created')->index();
$table->index('access');
$table->index(
[
'name' => 'text'
],
'search'
);
});
}

View File

@ -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'
);
});
}

View File

@ -1,38 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProfilesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->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');
}
}

View File

@ -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'
);
});
}

View File

@ -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'
);
});
}

View File

@ -1,166 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCachingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('anime_characters_staff', function (Blueprint $table) {
$table->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');
}
}

View File

@ -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');