Add (keyword model)

This commit is contained in:
2023-11-23 00:42:38 +08:00
parent f7d4a982e0
commit 7239b7e9ae
7 changed files with 218 additions and 12 deletions

View File

@@ -0,0 +1,38 @@
<?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('rss_post_keywords', function (Blueprint $table) {
$table->id();
$table->foreignId('rss_post_id');
$table->enum('type',['keyword','entity']);
$table->boolean('is_main')->default(false);
$table->string('value');
$table->string('value_lowercased');
$table->timestamps();
$table->foreign('rss_post_id')->references('id')->on('rss_posts');
$table->index('value');
$table->index('value_lowercased');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('rss_post_keywords');
}
};

View File

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