File: /var/www/html/laravel/database/migrations/2026_01_21_072322_data_correction.php
<?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
{
/**
* Run the migrations.
*/
public function up(): void
{
DB::statement("
UPDATE notams set correct_response = output where correct_response IS NULL AND output IS NOT NULL;
");
DB::statement("
UPDATE notams set local_correct_response = local_output where local_correct_response IS NULL AND local_output IS NOT NULL;
");
DB::statement("ALTER TABLE `notams` ADD INDEX `notams_chatgpt_response_idx` (`chatgpt_response`(500));");
DB::statement("ALTER TABLE `notams` ADD INDEX `notams_local_response_created_at_idx` (`local_response`(500), `created_at`);");
Schema::table('notams', function (Blueprint $table) {
$table->index('gpt_rag');
$table->index('local_sent');
$table->index('gpt_processing_time');
$table->index('local_processing_time');
$table->index(['start_date', 'end_date'], 'notams_start_end_idx');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};