<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
    public function up(): void
    {
        // Disable foreign key checks
        DB::statement('SET FOREIGN_KEY_CHECKS=0;');
        // Drop Messenger tables if they exist
        Schema::dropIfExists('bot_actions');
        Schema::dropIfExists('bots');
        Schema::dropIfExists('call_participants');
        Schema::dropIfExists('calls');
        Schema::dropIfExists('friend_drivers');
        Schema::dropIfExists('friends');
        Schema::dropIfExists('group_invitations');
        Schema::dropIfExists('invite_codes');
        Schema::dropIfExists('message_edits');
        Schema::dropIfExists('message_reactions');
        Schema::dropIfExists('message_reads');
        Schema::dropIfExists('messages');
        Schema::dropIfExists('participants');
        Schema::dropIfExists('pending_calls');
        Schema::dropIfExists('threads');
        Schema::dropIfExists('thread_invites');
        Schema::dropIfExists('thread_settings');
        Schema::dropIfExists('thread_stickies');
        Schema::dropIfExists('thread_types');
        Schema::dropIfExists('thread_unread');
        Schema::dropIfExists('thread_user_settings');
        // Add any other Messenger tables you find in the migrations
    }

    public function down(): void
    {
        // No down method, as this is a destructive migration
    }
};
