39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::create('articles', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('feed_id')->constrained()->cascadeOnDelete();
|
|
$table->string('guid'); // <guid> or Atom <id>, this is what dedupes
|
|
$table->string('title');
|
|
$table->text('description')->nullable();
|
|
$table->string('link');
|
|
$table->string('author')->nullable();
|
|
$table->string('image_url')->nullable();
|
|
$table->timestamp('published_at')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->unique(['feed_id', 'guid']);
|
|
$table->index(['feed_id', 'published_at']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('articles');
|
|
}
|
|
};
|