Add (news bites)

This commit is contained in:
2023-11-21 19:18:11 +08:00
parent 2e38a4120c
commit 3210563e42
37 changed files with 1581 additions and 153 deletions

View File

@@ -17,6 +17,7 @@ public function up(): void
$table->foreignId('category_id')->nullable();
$table->string('category_name')->nullable();
$table->string('source')->default('serp');
$table->string('source_url')->nullable();
$table->string('url');
$table->string('country_iso');
$table->string('title')->nullable();

View File

@@ -21,6 +21,7 @@ public function up(): void
$table->mediumText('bites')->nullable();
$table->mediumText('society_impact')->nullable();
$table->enum('society_impact_level', ['low', 'medium', 'high'])->default('low');
$table->string('image_ref_url')->nullable();
$table->foreignId('author_id')->nullable();
$table->mediumText('featured_image')->nullable();
$table->text('body')->nullable();

View File

@@ -1,28 +0,0 @@
<?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::table('posts', function (Blueprint $table) {
$table->string('image_ref_url')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('posts', function (Blueprint $table) {
$table->dropColumn(('image_ref_url'));
});
}
};

View File

@@ -0,0 +1,56 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('rss_posts', function (Blueprint $table) {
$table->id();
$table->foreignId('category_id')->nullable();
$table->string('source');
$table->string('source_url');
$table->string('post_url');
$table->string('title');
$table->string('slug');
$table->text('body')->nullable();
$table->jsonb('keywords')->nullable();
$table->jsonb('entities')->nullable();
$table->json('metadata')->nullable();
$table->mediumText('bites')->nullable();
$table->mediumText('impact')->nullable();
$table->enum('impact_level', ['low', 'medium', 'high'])->default('low');
$table->datetime('published_at');
$table->enum('status', ['draft', 'published', 'blocked', 'trashed'])->default('draft');
$table->timestamps();
$table->index('title');
$table->index('slug');
$table->index('published_at');
$table->foreign('category_id')->references('id')->on('categories');
});
DB::statement('CREATE INDEX idx_rss_posts_entities ON rss_posts USING gin (entities jsonb_path_ops)');
DB::statement('CREATE INDEX idx_rss_posts_keywords ON rss_posts USING gin (keywords jsonb_path_ops)');
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('rss_posts');
}
};