add people & characters migrations

This commit is contained in:
Irfan 2020-06-08 09:37:55 +05:00
parent 72f7191512
commit 022879aa02
3 changed files with 80 additions and 1 deletions

View File

@ -8,7 +8,7 @@ class CreateIndex extends Migration
{
const IGNORE = [
'anime', 'manga'
'anime', 'manga', 'people', 'characters'
];
/**

View File

@ -0,0 +1,40 @@
<?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->string('url');
$table->string('image_url');
$table->string('website_url');
$table->index('name');
$table->string('given_name')->index()->nullable();
$table->string('family_name')->index()->nullable();
$table->date('birthday');
$table->integer('member_favorites')->index('member_favorites');
$table->string('about')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('people');
}
}

View File

@ -0,0 +1,39 @@
<?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->string('url');
$table->string('image_url');
$table->index('name');
$table->index('name_kanji');
$table->integer('popularity')->index('popularity');
$table->integer('members')->index('members');
$table->integer('member_favorites')->index('member_favorites');
$table->string('about')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('characters');
}
}