Files
dredgenews/database/migrations/2026_07_04_114559_create_articles_table.php
T
dredgy 439139a057
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled
Done
2026-07-04 23:09:00 +10:00

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');
}
};