ORIENT/plugins/vdlp/rssfetcher/updates/20180718_0002_create_items_...

54 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
namespace Vdlp\RssFetcher\Updates;
use Illuminate\Database\Schema\Blueprint;
use October\Rain\Database\Updates\Migration;
use Schema;
/** @noinspection AutoloadingIssuesInspection */
class CreateItemsTable extends Migration
{
/**
* Up
*/
public function up(): void
{
Schema::create('vdlp_rssfetcher_items', function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->increments('id');
$table->unsignedInteger('source_id');
$table->string('item_id', 191)->unique('item_id_unique');
$table->string('title')->nullable();
$table->string('link')->nullable();
$table->mediumText('description')->nullable();
$table->string('author')->nullable();
$table->mediumText('category')->nullable();
$table->string('comments')->nullable();
$table->string('enclosure_type')->nullable();
$table->unsignedInteger('enclosure_length')->nullable();
$table->mediumText('enclosure_url')->nullable();
$table->dateTimeTz('pub_date')->nullable();
$table->boolean('publish_new_items')->default(true);
$table->boolean('is_published')->default(true);
$table->timestamps();
$table->foreign('source_id')
->references('id')
->on('vdlp_rssfetcher_sources')
->onDelete('cascade');
});
}
/**
* Down
*/
public function down(): void
{
Schema::dropIfExists('vdlp_rssfetcher_items');
}
}