Files
FlightsAPI/database/migrations/2026_04_07_072737_add_municipality.php
2026-04-07 18:11:12 +10:00

114 lines
7.9 KiB
PHP

<?php
use App\Models\Airline;
use App\Models\Airport;
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
{
Airport::where('iata_code', 'LZR')->update(['municipality' => 'Lizard Island']);
Airport::where('iata_code', 'SYD')->update(['municipality' => 'Sydney']);
Airport::where('iata_code', 'ISB')->update(['municipality' => 'Islamabad']);
Airport::where('iata_code', 'KUL')->update(['municipality' => 'Kuala Lumpur']);
Airport::where('iata_code', 'USM')->update(['municipality' => 'Ko Samui']);
Airport::where('iata_code', 'CDG')->update(['municipality' => 'Paris']);
Airport::where('iata_code', 'ORY')->update(['municipality' => 'Paris']);
Airport::where('iata_code', 'FRA')->update(['municipality' => 'Frankfurt']);
Airport::where('iata_code', 'EZE')->update(['municipality' => 'Buenos Aires']);
Airport::where('iata_code', 'PVG')->update(['municipality' => 'Shanghai']);
Airport::where('iata_code', 'MRU')->update(['municipality' => 'Mauritius']);
Airport::where('iata_code', 'HNL')->update(['municipality' => 'Honolulu']);
Airport::where('iata_code', 'NCL')->update(['municipality' => 'Newcastle upon Tyne']);
Airport::where('iata_code', 'KRK')->update(['municipality' => 'Krakow']);
Airport::where('iata_code', 'OTP')->update(['municipality' => 'Bucharest']);
Airport::where('iata_code', 'CAN')->update(['municipality' => 'Guangzhou']);
Airport::where('iata_code', 'XIY')->update(['municipality' => "Xi'an"]);
Airport::where('iata_code', 'ROR')->update(['municipality' => "Koror"]);
Airport::where('iata_code', 'WUH')->update(['municipality' => "Wuhan"]);
Airport::where('iata_code', 'CCS')->update(['municipality' => "Caracas"]);
Airport::where('iata_code', 'TFU')->update(['municipality' => "Chengdu"]);
Airport::where('iata_code', 'CTU')->update(['municipality' => "Chengdu"]);
Airport::where('iata_code', 'DMM')->update(['municipality' => "Dammam"]);
Airport::where('iata_code', 'VCE')->update(['municipality' => "Venice"]);
Airport::where('iata_code', 'MXP')->update(['municipality' => "Milan"]);
Airport::where('iata_code', 'DPS')->update(['municipality' => "Denpasar"]);
Airport::where('iata_code', 'CAY')->update(['municipality' => "Cayenne"]);
Airport::where('iata_code', 'LPA')->update(['municipality' => "Gran Canaria"]);
Airline::where('internal_name', 'thy-turkish-airlines')->update(['name' => 'Turkish Airlines']);
Airline::where('internal_name', 'air-china')->update(['name' => 'Air China']);
Airline::where('internal_name', 'jetstar-airways-pty')->update(['name' => 'Jetstar']);
Airline::where('internal_name', 'easyjet')->update(['name' => 'Easyjet']);
Airline::where('internal_name', 'china-west-air')->update(['name' => 'China West Air']);
Airline::where('internal_name', 'aeroenlaces-nacionales-s-a-de-c-v')->update(['name' => 'Viva']);
Airline::where('internal_name', 'aircompany-somon-air')->update(['name' => 'Somon Air']);
Airline::where('internal_name', 'hinterland-aviation-pty')->update(['name' => 'Hinterland Aviation']);
Airline::where('internal_name', 'mango-airlines-soc-trading-as-mango')->update(['name' => 'Mango']);
Airline::where('internal_name', 'air-manas-dba-air-manas-air')->update(['name' => 'Air Manas']);
Airline::where('internal_name', 'airasia-x-berhad-dba-airasia-x')->update(['name' => 'Air Asia X']);
Airline::where('internal_name', 'mesa-airlines')->update(['name' => 'Mesa Airlines']);
Airport::where('iata_code', 'MCT')->update(['municipality' => "Muscat"]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Airport::where('iata_code', 'LZR')->update(['municipality' => '']);
Airport::where('iata_code', 'SYD')->update(['municipality' => 'Sydney (Mascot)']);
Airport::where('iata_code', 'ISB')->update(['municipality' => 'Attock']);
Airport::where('iata_code', 'KUL')->update(['municipality' => 'Sepang']);
Airport::where('iata_code', 'USM')->update(['municipality' => 'Na Thon (Ko Samui Island)']);
Airport::where('iata_code', 'CDG')->update(['municipality' => "Paris (Roissy-en-France, Val-d'Oise)"]);
Airport::where('iata_code', 'ORY')->update(['municipality' => "Paris (Orly, Val-de-Marne)"]);
Airport::where('iata_code', 'FRA')->update(['municipality' => 'Frankfurt am Main']);
Airport::where('iata_code', 'EZE')->update(['municipality' => 'Buenos Aires (Ezeiza)']);
Airport::where('iata_code', 'PVG')->update(['municipality' => 'Shanghai (Pudong)']);
Airport::where('iata_code', 'MRU')->update(['municipality' => 'Plaine Magnien']);
Airport::where('iata_code', 'HNL')->update(['municipality' => 'Honolulu, Oahu']);
Airport::where('iata_code', 'NCL')->update(['municipality' => 'Newcastle upon Tyne, Tyne and Wear']);
Airport::where('iata_code', 'KRK')->update(['municipality' => 'Balice']);
Airport::where('iata_code', 'OTP')->update(['municipality' => 'Otopeni']);
Airport::where('iata_code', 'CAN')->update(['municipality' => 'Guangzhou (Huadu)']);
Airport::where('iata_code', 'XIY')->update(['municipality' => "Xianyang (Weicheng)"]);
Airport::where('iata_code', 'ROR')->update(['municipality' => "Babelthuap Island"]);
Airport::where('iata_code', 'WUH')->update(['municipality' => "Wuhan (Huangpi)"]);
Airport::where('iata_code', 'CCS')->update(['municipality' => "Maiquetía"]);
Airport::where('iata_code', 'TFU')->update(['municipality' => "Chengdu (Jianyang)"]);
Airport::where('iata_code', 'CTU')->update(['municipality' => "Chengdu (Shuangliu)"]);
Airport::where('iata_code', 'DMM')->update(['municipality' => "Ad Dammam"]);
Airport::where('iata_code', 'VCE')->update(['municipality' => "Venezia (VE)"]);
Airport::where('iata_code', 'MXP')->update(['municipality' => "Ferno (VA)"]);
Airport::where('iata_code', 'DPS')->update(['municipality' => "Kuta, Badung"]);
Airport::where('iata_code', 'CAY')->update(['municipality' => "Matoury"]);
Airport::where('iata_code', 'LPA')->update(['municipality' => "Gran Canaria Island"]);
Airport::where('iata_code', 'MCT')->update(['municipality' => "Muscat/Seeb"]);
Airline::where('internal_name', 'thy-turkish-airlines')->update(['name' => ' THY - Turkish Airlines']);
Airline::where('internal_name', 'air-china')->update(['name' => 'Air China Limited']);
Airline::where('internal_name', 'jetstar-airways-pty')->update(['name' => 'Jetstar Airways Pty Limited']);
Airline::where('internal_name', 'easyjet')->update(['name' => 'Easyjet Airline Company Limited']);
Airline::where('internal_name', 'china-west-air')->update(['name' => 'China West Air Co. Ltd.']);
Airline::where('internal_name', 'aeroenlaces-nacionales-s-a-de-c-v')->update(['name' => 'Aeroenlaces Nacionales S.A. De C.V.']);
Airline::where('internal_name', 'aircompany-somon-air')->update(['name' => 'Aircompany Somon Air LLC']);
Airline::where('internal_name', 'hinterland-aviation-pty')->update(['name' => 'Hinterland Aviation Pty Ltd']);
Airline::where('internal_name', 'mango-airlines-soc-trading-as-mango')->update(['name' => 'Mango Airlines (SOC) Ltd trading as MANGO']);
Airline::where('internal_name', 'air-manas-dba-air-manas-air')->update(['name' => 'Air Manas dba Air Manas ltd. Air Company']);
Airline::where('internal_name', 'airasia-x-berhad-dba-airasia-x')->update(['name' => 'Airasia X Berhad dba Airasia X']);
Airline::where('internal_name', 'mesa-airlines')->update(['name' => 'Mesa Airlines, Inc']);
}
};