update migrations

This commit is contained in:
Irfan 2022-02-24 05:16:31 +05:00
parent 63b96026d5
commit 1afc7cb763
11 changed files with 352 additions and 113 deletions

View File

@ -17,51 +17,54 @@ class CreateAnimeTable extends Migration
Schema::create('anime', function (Blueprint $table) {
$table->unique(['request_hash' => 1], 'request_hash');
$table->unique(['mal_id' => 1], 'mal_id');
$table->string('url');
$table->string('images');
$table->string('trailer_url');
$table->index('title');
$table->index('title_english');
$table->index('title_japanese');
$table->enum('type', ['TV', 'Movie', 'OVA', 'Special', 'ONA', 'Music'])->index('type');
$table->index('source');
$table->integer('episodes')->index('episodes');
$table->string('status')->index();
$table->boolean('airing');
$table->string( 'duration');
$table->string('rating')->index('rating');
$table->float('score')->index('score');
$table->integer('scored_by')->index('scored_by');
$table->integer('rank')->index('rank')->nullable();
$table->integer('popularity')->index('popularity');
$table->index('aired', 'aired');
$table->index(['aired.from' => 1], 'aired.from');
$table->index(['aired.to' => 1], 'aired.to');
$table->index('airing', 'airing');
$table->index('demographics.mal_id', 'demographics.mal_id');
$table->index('explicit_genres.mal_id', 'explicit_genres.mal_id');
$table->index('genres.mal_id', 'genres.mal_id');
$table->index('licensors.mal_id', 'licensors.mal_id');
$table->index('producers.mal_id', 'producers.mal_id');
$table->index('studios.mal_id', 'studios.mal_id');
$table->index('themes.mal_id', 'themes.mal_id');
$table->index('episodes', 'episodes');
$table->index('favorites', 'favorites');
$table->integer('members')->index('members');
$table->integer('favorites')->index('favorites');
$table->string('synopsis')->nullable();
$table->string('background')->nullable();
$table->index('genres.mal_id');
$table->index('licensors.mal_id');
$table->index('producers.mal_id');
$table->index('studios.mal_id');
$table->index(['aired.from' => 1], 'start_date');
$table->index(['aired.to' => 1], 'end_date');
$table->index([
'title' => 'text',
'title_japanese' => 'text',
'title_english' => 'text',
'title_synonyms' => 'text',
$table->integer('popularity')->index('popularity');
$table->integer('rank')->index('rank')->nullable();
$table->index('rating', 'rating');
$table->float('score')->index('score');
$table->integer('scored_by')->index('scored_by');
$table->index('status', 'status');
$table->index('type', 'type');
$table->index('source', 'source');
$table->index('title', 'title');
$table->index('title_english', 'title_english');
$table->index('title_japanese', 'title_japanese');
$table->index('title_synonyms', 'title_synonyms');
$table->index(
[
'title' => 'text',
'title_japanese' => 'text'
],
'anime_search_index',
'search',
null,
[
'weights' => [
'title' => 50,
'title_japanese' => 10,
'title_english' => 10,
'title_synonyms' => 1
'title_japanese' => 5
],
'name' => 'anime_search_index'
'name' => 'search'
]
);
$table->timestamps();
});
}

View File

@ -16,46 +16,53 @@ class CreateMangaTable extends Migration
Schema::create('manga', function (Blueprint $table) {
$table->unique(['request_hash' => 1], 'request_hash');
$table->unique(['mal_id' => 1], 'mal_id');
$table->string('url');
$table->string('images');
$table->index('title');
$table->index('title_english');
$table->index('title_japanese');
$table->enum('type', ['Manga', 'Novel', 'Light Novel', 'One-shot', 'Doujinshi', 'Manhwa', 'Manhua', 'OEL']);
$table->integer('chapters')->index('chapters');
$table->integer('volumes')->index('volumes');
$table->string('status')->index();
$table->boolean('publishing');
$table->float('score')->index('score');
$table->float('scored_by')->index('scored_by');
$table->integer('rank')->index('rank');
$table->integer('popularity')->index('popularity');
$table->index('published', 'published');
$table->index(['published.from' => 1], 'published.from');
$table->index(['published.to' => 1], 'published.to');
$table->index('publishing', 'publishing');
$table->index('demographics.mal_id', 'demographics.mal_id');
$table->index('explicit_genres.mal_id', 'explicit_genres.mal_id');
$table->index('genres.mal_id', 'genres.mal_id');
$table->index('authors.mal_id', 'authors.mal_id');
$table->index('serializations.mal_id', 'serializations.mal_id');
$table->index('themes.mal_id', 'themes.mal_id');
$table->index('chapters', 'chapters');
$table->index('volumes', 'volumes');
$table->index('favorites', 'favorites');
$table->integer('members')->index('members');
$table->integer('favorites')->index('favorites');
$table->string('synopsis')->nullable();
$table->string('background')->nullable();
$table->index('genres.mal_id');
$table->index('serializations.mal_id');
$table->index(['published.from' => 1], 'start_date');
$table->index(['published.to' => 1], 'end_date');
$table->index([
'title' => 'text',
'title_japanese' => 'text',
'title_english' => 'text',
'title_synonyms' => 'text',
],
'manga_search_index',
$table->integer('popularity')->index('popularity');
$table->integer('rank')->index('rank')->nullable();
$table->float('score')->index('score');
$table->integer('scored_by')->index('scored_by');
$table->index('status', 'status');
$table->index('type', 'type');
$table->index('title', 'title');
$table->index('title_english', 'title_english');
$table->index('title_japanese', 'title_japanese');
$table->index('title_synonyms', 'title_synonyms');
$table->index(
[
'title' => 'text',
'title_japanese' => 'text'
],
'search',
null,
[
'weights' => [
'title' => 50,
'title_japanese' => 10,
'title_english' => 10,
'title_synonyms' => 1
'title_japanese' => 5
],
'name' => 'manga_search_index'
'name' => 'search'
]
);
$table->timestamps();
});
}

View File

@ -16,37 +16,34 @@ class CreatePeopleTable extends Migration
Schema::create('people', function (Blueprint $table) {
$table->unique(['request_hash' => 1], 'request_hash');
$table->unique(['mal_id' => 1], 'mal_id');
$table->string('url');
$table->string('images');
$table->string('website_url');
$table->index('name');
$table->string('given_name')->index()->nullable();
$table->string('family_name')->index()->nullable();
$table->index('alternate_names');
$table->date('birthday')->index();
$table->integer('member_favorites')->index('member_favorites');
$table->string('about')->nullable();
$table->index('voice_acting_roles');
$table->index('anime_staff_positions');
$table->index('published_manga');
$table->index([
'name' => 'text',
'given_name' => 'text',
'family_name' => 'text',
'alternate_names' => 'text',
],
'people_search_index',
$table->date('birthday')->index('birthday');
$table->index('member_favorites', 'member_favorites');
$table->index('name', 'name');
$table->string('given_name')->index('name')->nullable();
$table->string('family_name')->index('family_name')->nullable();
$table->index('alternate_names', 'alternate_names');
$table->index(
[
'name' => 'text',
'given_name' => 'text',
'family_name' => 'text'
],
'search',
null,
[
'weights' => [
'name' => 50,
'given_name' => 10,
'family_name' => 10,
'alternate_names' => 1
'given_name' => 5,
'family_name' => 5,
],
'name' => 'people_search_index'
'name' => 'search'
]
);
$table->timestamps();
});
}

View File

@ -16,27 +16,31 @@ class CreateCharactersTable extends Migration
Schema::create('characters', function (Blueprint $table) {
$table->unique(['request_hash' => 1], 'request_hash');
$table->unique(['mal_id' => 1], 'mal_id');
$table->string('url');
$table->string('images');
$table->index('name');
$table->index('name_kanji');
$table->index('nicknames');
$table->integer('member_favorites')->index('member_favorites');
$table->string('about')->nullable();
$table->index([
'name' => 'text',
'nicknames' => 'text',
],
'characters_search_index',
$table->date('birthday')->index('birthday');
$table->index('member_favorites', 'member_favorites');
$table->index('name', 'name');
$table->string('name_kanji')->index('name_kanji');
$table->string('nicknames')->index('nicknames');
$table->index(
[
'name' => 'text',
'name_kanji' => 'text'
],
'search',
null,
[
'weights' => [
'name' => 50,
'nicknames' => 10,
'name_kanji' => 5
],
'name' => 'characters_search_index'
'name' => 'search'
]
);
$table->timestamps();
});
}

View File

@ -16,8 +16,8 @@ class CreateMagazinesTable extends Migration
{
Schema::create('magazines', function (Blueprint $table) {
$table->unique(['mal_id' => 1], 'mal_id');
$table->index('count');
$table->timestamps();
$table->index('count', 'count');
$table->index('name', 'name');
});
}

View File

@ -16,12 +16,11 @@ class CreateClubsTable extends Migration
Schema::create('clubs', function (Blueprint $table) {
$table->unique(['request_hash' => 1], 'request_hash');
$table->unique(['mal_id' => 1], 'mal_id');
$table->index('title');
$table->index('members_count');
$table->index('pictures_count');
$table->index('name');
$table->index('members', 'members');
$table->index('category');
$table->date('created');
$table->index('type');
$table->date('created')->index();
$table->index('access');
});
}

View File

@ -15,8 +15,8 @@ class CreateProducersTable extends Migration
{
Schema::create('producers', function (Blueprint $table) {
$table->unique(['mal_id' => 1], 'mal_id');
$table->index('count');
$table->timestamps();
$table->index('count', 'count');
$table->index('name', 'name');
});
}

View File

@ -15,18 +15,26 @@ class CreateGenresAnimeTable extends Migration
{
Schema::create('genres_anime', function (Blueprint $table) {
$table->unique(['mal_id' => 1], 'mal_id');
$table->index('count', 'count');
$table->index('name', 'name');
});
Schema::create('demographics_anime', function (Blueprint $table) {
$table->unique(['mal_id' => 1], 'mal_id');
$table->index('count', 'count');
$table->index('name', 'name');
});
Schema::create('explicit_genres_anime', function (Blueprint $table) {
$table->unique(['mal_id' => 1], 'mal_id');
$table->index('count', 'count');
$table->index('name', 'name');
});
Schema::create('themes_anime', function (Blueprint $table) {
$table->unique(['mal_id' => 1], 'mal_id');
$table->index('count', 'count');
$table->index('name', 'name');
});
}

View File

@ -15,18 +15,26 @@ class CreateGenresMangaTable extends Migration
{
Schema::create('genres_manga', function (Blueprint $table) {
$table->unique(['mal_id' => 1], 'mal_id');
$table->index('count', 'count');
$table->index('name', 'name');
});
Schema::create('explicit_genres_manga', function (Blueprint $table) {
$table->unique(['mal_id' => 1], 'mal_id');
$table->index('count', 'count');
$table->index('name', 'name');
});
Schema::create('demographics_manga', function (Blueprint $table) {
$table->unique(['mal_id' => 1], 'mal_id');
$table->index('count', 'count');
$table->index('name', 'name');
});
Schema::create('themes_manga', function (Blueprint $table) {
$table->unique(['mal_id' => 1], 'mal_id');
$table->index('count', 'count');
$table->index('name', 'name');
});
}

View File

@ -0,0 +1,166 @@
<?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

@ -0,0 +1,47 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->unique(['request_hash' => 1], 'request_hash');
$table->unique(['internal_username' => 1], 'internal_username');
$table->date('joined')->index('joined');
$table->date('birthday')->index('birthday');
$table->date('last_online')->index('last_online');
$table->index('gender', 'gender');
$table->index('location', 'location');
$table->index(
[
'internal_username' => 'text'
],
'search'
);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}