Use AnidbInfo model, update related migration

This commit is contained in:
DariusIII
2017-09-04 13:04:27 +02:00
parent c4f76cb1dc
commit e6f87341de
5 changed files with 92 additions and 42 deletions
+1
View File
@@ -1,4 +1,5 @@
2017-09-04 DariusIII
* Chg: Use AnidbInfo model, update related migration
* Chg: Rename AnidbEpisodes to AnidbEpisode
* Chg: Use AnidbEpisodes model where applicable
* Chg: Update and use Genre model, update related migration
+38 -1
View File
@@ -6,5 +6,42 @@ use Illuminate\Database\Eloquent\Model;
class AnidbInfo extends Model
{
//
/**
* @var string
*/
protected $primaryKey = 'anidbid';
/**
* @var bool
*/
protected $dateFormat = false;
/**
* @var bool
*/
public $incrementing = false;
/**
* @var bool
*/
public $timestamps = false;
/**
* @var array
*/
protected $fillable = [
'anidbid',
'type',
'startdate',
'enddate',
'updated',
'related',
'similar',
'creators',
'description',
'rating',
'picture',
'categories',
'characters',
];
}
+10 -10
View File
@@ -11,16 +11,16 @@ $dotenv->load();
$capsule = new Capsule;
$capsule->addConnection([
'driver' => env('DB_SYSTEM'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_NAME', 'nntmux'),
'username' => env('DB_USER', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'strict' => false,
'driver' => env('DB_SYSTEM', 'mysql'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_NAME', 'nntmux'),
'username' => env('DB_USER', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'strict' => false,
]);
$capsule->setAsGlobal();
@@ -0,0 +1,43 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAnidbInfoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('anidb_info', function (Blueprint $table) {
$table->integer('anidbid', false, true)->comment('ID of title from AniDB');
$table->string('type');
$table->date('startdate');
$table->date('enddate');
$table->timestamp('updated');
$table->string('related');
$table->string('similar');
$table->string('creators');
$table->text('description');
$table->string('rating');
$table->string('picture');
$table->string('categories');
$table->string('characters');
$table->index(['startdate', 'enddate', 'updated']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('anidb_info');
}
}
@@ -1,31 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAnidbInfoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('anidb_info', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('anidb_info');
}
}