mirror of
https://github.com/jikan-me/jikan-rest.git
synced 2025-02-20 11:23:35 +08:00
squashed migrations
This commit is contained in:
parent
865747a20b
commit
5f5dbc12f1
@ -1,60 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIndex extends Migration
|
||||
{
|
||||
|
||||
const IGNORE = [
|
||||
'anime', 'manga', 'people', 'characters', 'magazines', 'producers', 'clubs', 'users'
|
||||
];
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$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::create($table, function (Blueprint $table) {
|
||||
$table->unique(['request_hash' => 1], 'request_hash');
|
||||
});
|
||||
|
||||
$mapped[] = $table;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateQueueIndex extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(env('QUEUE_TABLE', 'jobs'), function (Blueprint $table) {
|
||||
$table->index(['queue', 'reserved_at']);
|
||||
$table->bigIncrements('id');
|
||||
$table->string('queue');
|
||||
$table->longText('payload');
|
||||
$table->tinyInteger('attempts')->unsigned();
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists(env('QUEUE_TABLE', 'jobs'));
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateQueueFailedIndex extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(env('QUEUE_FAILED_TABLE', 'jobs_failed'), function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists(env('QUEUE_FAILED_TABLE', 'jobs_failed'));
|
||||
}
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
<?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->unique(['request_hash' => 1], 'request_hash');
|
||||
$table->unique(['mal_id' => 1], 'mal_id');
|
||||
|
||||
$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->integer('members')->index('members');
|
||||
$table->integer('favorites')->index('favorites');
|
||||
$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'
|
||||
],
|
||||
'search',
|
||||
null,
|
||||
[
|
||||
'weights' => [
|
||||
'title' => 50,
|
||||
'title_japanese' => 5
|
||||
],
|
||||
'name' => 'search'
|
||||
]
|
||||
);
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('anime');
|
||||
}
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMangaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('manga', function (Blueprint $table) {
|
||||
$table->unique(['request_hash' => 1], 'request_hash');
|
||||
$table->unique(['mal_id' => 1], 'mal_id');
|
||||
|
||||
$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->integer('members')->index('members');
|
||||
$table->integer('favorites')->index('favorites');
|
||||
$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' => 5
|
||||
],
|
||||
'name' => 'search'
|
||||
]
|
||||
);
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('manga');
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePeopleTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('people', function (Blueprint $table) {
|
||||
$table->unique(['request_hash' => 1], 'request_hash');
|
||||
$table->unique(['mal_id' => 1], 'mal_id');
|
||||
|
||||
$table->date('birthday')->index('birthday');
|
||||
$table->index('member_favorites', 'member_favorites');
|
||||
|
||||
$table->index('name', 'name');
|
||||
$table->string('given_name')->index('given_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' => 5,
|
||||
'family_name' => 5,
|
||||
],
|
||||
'name' => 'search'
|
||||
]
|
||||
);
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('people');
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCharactersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('characters', function (Blueprint $table) {
|
||||
$table->unique(['request_hash' => 1], 'request_hash');
|
||||
$table->unique(['mal_id' => 1], 'mal_id');
|
||||
|
||||
$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,
|
||||
'name_kanji' => 5
|
||||
],
|
||||
'name' => 'search'
|
||||
]
|
||||
);
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('characters');
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMagazinesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function up()
|
||||
{
|
||||
Schema::create('magazines', function (Blueprint $table) {
|
||||
$table->unique(['mal_id' => 1], 'mal_id');
|
||||
$table->index('count', 'count');
|
||||
$table->index('name', 'name');
|
||||
|
||||
$table->index(
|
||||
[
|
||||
'name' => 'text'
|
||||
],
|
||||
'search'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('magazines');
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateClubsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('clubs', function (Blueprint $table) {
|
||||
$table->unique(['request_hash' => 1], 'request_hash');
|
||||
$table->unique(['mal_id' => 1], 'mal_id');
|
||||
$table->index('name');
|
||||
$table->index('members', 'members');
|
||||
$table->index('category');
|
||||
$table->date('created')->index();
|
||||
$table->index('access');
|
||||
|
||||
$table->index(
|
||||
[
|
||||
'name' => 'text'
|
||||
],
|
||||
'search'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('clubs');
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateProducersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('producers', function (Blueprint $table) {
|
||||
$table->unique(['mal_id' => 1], 'mal_id');
|
||||
$table->index('count', 'count');
|
||||
$table->index('name', 'name');
|
||||
$table->index('titles', 'titles');
|
||||
$table->index('established', 'established');
|
||||
$table->index('favorites', 'favorites');
|
||||
|
||||
$table->index(
|
||||
[
|
||||
'name' => 'text'
|
||||
],
|
||||
'search'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('producers');
|
||||
}
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateGenresAnimeTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('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('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'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('genres_anime');
|
||||
Schema::dropIfExists('demographics_anime');
|
||||
Schema::dropIfExists('explicit_genres_anime');
|
||||
Schema::dropIfExists('themes_anime');
|
||||
}
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateGenresMangaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('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('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'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('genres_manga');
|
||||
Schema::dropIfExists('explicit_genres_manga');
|
||||
Schema::dropIfExists('demographics_manga');
|
||||
Schema::dropIfExists('themes_manga');
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
<?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(['mal_id' => 1], 'mal_id');
|
||||
$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');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user