Files
FlightsAPI/database/migrations/2026_04_01_041000_add_bonza.php
T
2026-04-02 09:37:34 +10:00

56 lines
1.4 KiB
PHP

<?php
use App\Models\Airline;
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
{
// Nullify logo for all existing AB airlines
DB::table('airlines')
->where('IATA_code', 'AB')
->update(['logo' => null]);
DB::table('airlines')
->where('IATA_code', 'AB')
->where('ICAO_code', 'BER')
->update(['active' => false]);
DB::table('airlines')->insert([
'IATA_code' => 'AB',
'ICAO_code' => 'BNZ',
'name' => 'Bonza',
'internal_name' => 'bonza',
'country_code' => 'AU',
'country_name' => 'Australia',
'active' => false,
'logo' => 'AB.png',
]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
DB::table('airlines')->where('internal_name', 'bonza')->delete();
DB::table('airlines')
->where('IATA_code', 'AB')
->update(['logo' => 'AB.png']);
DB::table('airlines')
->where('IATA_code', 'AB')
->where('ICAO_code', 'BER')
->update(['active' => true]);
}
};