This commit is contained in:
ct
2025-06-19 22:24:47 +08:00
parent 5d3a3c8818
commit 7712101b76
11 changed files with 489 additions and 22 deletions

View File

@@ -0,0 +1,59 @@
<?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
{
// {#488 ▼ // app/Http/Controllers/TestController.php:24
// +"caption": "thesis writing procrastination blues"
// +"meme_keywords": array:3 [▼
// 0 => "anxiety"
// 1 => "overwhelm"
// 2 => "imposter syndrome"
// ]
// +"background": "cluttered desk with piles of papers and a laptop"
// +"keywords": array:3 [▼
// 0 => "thesis"
// 1 => "anxiety"
// 2 => "breaks"
// ]
// }
Schema::create('memes', function (Blueprint $table) {
$table->id();
$table->enum('type', ['single_caption_meme_background'])->default('single_caption_meme_background');
$table->boolean('is_system');
$table->foreignId('category_id')->nullable();
$table->foreignId('user_id')->nullable();
$table->foreignId('meme_id')->nullable();
$table->foreignId('background_id')->nullable();
$table->enum('status', ['pending', 'completed'])->default('pending');
$table->text('prompt');
$table->string('caption')->nullable();
$table->json('meme_keywords')->nullable();
$table->string('background')->nullable();
$table->json('keywords');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('memes');
}
};

View File

@@ -268,7 +268,7 @@ private function importSingleMeme(array $meme_record): bool
private function attachKeywordsAsTags(MemeMedia $meme_media, array $keywords): void
{
try {
$meme_media->attachTags($keywords, 'meme');
$meme_media->attachTags($keywords, 'meme_media');
} catch (\Exception $e) {
$this->command->warn("Failed to attach tags to meme media '{$meme_media->name}': " . $e->getMessage());
Log::warning("Failed to attach tags", [