Instagram jobs refactor + started InstagramNotifications

This commit is contained in:
2025-08-05 13:25:25 +02:00
parent 1f23b112d7
commit aa936a2a11
9 changed files with 444 additions and 86 deletions

View File

@ -0,0 +1,50 @@
<?php
use App\Models\InstagramNotificationType;
use App\Models\InstagramRepost;
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('instagram_notifications', function (Blueprint $table) {
$table->id();
$table->string('username')->nullable();
$table->foreignIdFor(InstagramRepost::class)->nullable()
->constrained('instagram_reposts')
->noActionOnDelete()
->cascadeOnUpdate();
$table->enum('notification_type', array_column(InstagramNotificationType::cases(), 'value'));
$table->text('message')->nullable();
$table->boolean('is_read')->default(false);
$table->boolean('is_processed')->default(false);
$table->unique(['username', 'instagram_repost_id', 'notification_type', 'message'], 'unique_instagram_notification');
$table->timestamps();
});
Schema::table('instagram_reposts', function (Blueprint $table) {
$table->string("repost_reel_id")->unique()->nullable()->comment('Reel ID of the reposted content');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('instagram_notifications');
Schema::table('instagram_reposts', function (Blueprint $table) {
$table->dropUnique(['repost_reel_id']);
$table->dropColumn("repost_reel_id");
});
}
};