<?php

defined('BASEPATH') or exit('No direct script access allowed');
class Migration_more_contests extends CI_Migration {

	public function up() {

		// Add contests from WA7BNM Contest Calender
		$contests = array(
			array('name' => '10-10 Int. 10-10 Day Sprint', 'adifname' => '10-10-SPRINT', 'active' => 1),
			array('name' => '10-10 Int. Fall Contest, CW', 'adifname' => '10-10-FALL-CW', 'active' => 1),
			array('name' => '10-10 Int. Fall Contest, Digital', 'adifname' => '10-10-FALL-DIGITAL', 'active' => 1),
			array('name' => '10-10 Int. Open Season PSK Contest', 'adifname' => '10-10-OPEN-SEASON', 'active' => 1),
			array('name' => '10-10 Int. Spring Contest, CW', 'adifname' => '10-10-SPRING-CW', 'active' => 1),
			array('name' => '10-10 Int. Spring Contest, Digital', 'adifname' => '10-10-SPRING-DIGITAL', 'active' => 1),
			array('name' => '10-10 Int. Summer Contest, SSB', 'adifname' => '10-10-SUMMER-PHONE', 'active' => 1),
			array('name' => '10-10 Int. Winter Contest, SSB', 'adifname' => '10-10-WINTER-PHONE', 'active' => 1),
			array('name' => 'A1Club AWT', 'adifname' => 'A1CLUB-AWT', 'active' => 1),
			array('name' => 'Africa All Mode International DX Contest', 'adifname' => 'ALL-AFRICA', 'active' => 1),
			array('name' => 'AGCW QRP/QRP Party', 'adifname' => 'AGCW-QRP', 'active' => 1),
			array('name' => 'ANZAC Day Contest', 'adifname' => 'ANZAC', 'active' => 1),
			array('name' => 'ARI 40/80 Contest', 'adifname' => '40-80', 'active' => 1),
			array('name' => 'ARRL Inter. Digital Contest', 'adifname' => 'ARRL-DIGI', 'active' => 1),
			array('name' => 'ARSI VU DX Contest', 'adifname' => 'ARSI-VU-DX', 'active' => 1),
			array('name' => 'Atlantic Canada QSO Party', 'adifname' => 'AC-QSO-PARTY', 'active' => 1),
			array('name' => 'Australia Day Contest', 'adifname' => 'WIA-AUSTRALIADAY', 'active' => 1),
			array('name' => 'Balkan HF Contest', 'adifname' => 'BALKAN-HF', 'active' => 1),
			array('name' => 'Baltic Contest', 'adifname' => 'BALTIC-CONTEST', 'active' => 1),
			array('name' => 'Bucharest Digital Contest', 'adifname' => 'BUCURESTI-DIGITAL', 'active' => 1),
			array('name' => 'Canadian Prairies QSO Party', 'adifname' => 'CP-QSO-PARTY', 'active' => 1),
			array('name' => 'Collegiate QSO Party', 'adifname' => 'CQP', 'active' => 1),
			array('name' => 'COVID-19 Radio Communication Event', 'adifname' => 'STAYHOME', 'active' => 1),
			array('name' => 'CQ Worldwide VHF Digital Contest', 'adifname' => 'CQ-VHF-DIGI', 'active' => 1),
			array('name' => 'CQ Worldwide VHF SSB/CW Contest', 'adifname' => 'CQ-VHF-SSBCW', 'active' => 1),
			array('name' => 'CQMM DX Contest', 'adifname' => 'CQMMDX', 'active' => 1),
			array('name' => 'Croatian DX Contest', 'adifname' => '9A-DX', 'active' => 1),
			array('name' => 'DARC Christmas Contest', 'adifname' => 'XMAS', 'active' => 1),
			array('name' => 'DIG QSO Party, CW', 'adifname' => 'DIG-QSO-PARTY', 'active' => 1),
			array('name' => 'DIG QSO Party, SSB', 'adifname' => 'DIG-QSO-PARTY', 'active' => 1),
			array('name' => 'DRCG WW RTTY Contest', 'adifname' => 'DRCG-WW-RTTY', 'active' => 1),
			array('name' => 'Dutch PACCdigi Contest', 'adifname' => 'PACCDIGI', 'active' => 1),
			array('name' => 'EA RTTY Contest', 'adifname' => 'EARTTY', 'active' => 1),
			array('name' => 'EANET Sprint', 'adifname' => 'EANET-SPRINT', 'active' => 1),
			array('name' => 'EurAsia HF Championship', 'adifname' => 'EURASIA-CHAMP', 'active' => 1),
			array('name' => 'European Union DX Contest', 'adifname' => 'EUDXC', 'active' => 1),
			array('name' => 'F9AA Cup, CW', 'adifname' => 'F9AA-CW', 'active' => 1),
			array('name' => 'F9AA Cup, PSK', 'adifname' => 'F9AA-DIGI', 'active' => 1),
			array('name' => 'F9AA Cup, SSB', 'adifname' => 'F9AA-SSB', 'active' => 1),
			array('name' => 'FIRAC HF Contest', 'adifname' => 'FIRAC-CONTEST', 'active' => 1),
			array('name' => 'FRAPR 10M Contest', 'adifname' => 'FRAPR-10M', 'active' => 1),
			array('name' => 'FT Challenge', 'adifname' => 'FT-CHALLENGE', 'active' => 1),
			array('name' => 'GACW WWSA CW DX Contest', 'adifname' => 'WWSA', 'active' => 1),
			array('name' => 'Gunung Jati DX Contest', 'adifname' => 'GUNUNGJATI', 'active' => 1),
			array('name' => 'HA3NS Sprint Memorial Contest', 'adifname' => 'HA3NS-SPRINT', 'active' => 1),
			array('name' => 'Ham Spirit Contest', 'adifname' => 'HAM-SPIRIT', 'active' => 1),
			array('name' => 'Ham Spirit Contest, SSB', 'adifname' => 'HAM-SPIRIT-SSB', 'active' => 1),
			array('name' => 'HARC Anniversary QSO Party', 'adifname' => 'HARC-QSOP', 'active' => 1),
			array('name' => 'Hiram Percy Maxim Birthday Celebration', 'adifname' => 'ARRL-HPM-150', 'active' => 1),
			array('name' => 'His Maj. King of Spain Contest, CW', 'adifname' => 'EA-MAJESTAD-CW', 'active' => 1),
			array('name' => 'His Maj. King of Spain Contest, SSB', 'adifname' => 'EA-MAJESTAD-SSB', 'active' => 1),
			array('name' => 'ICWC Medium Speed Test', 'adifname' => 'ICWC-MST', 'active' => 1),
			array('name' => 'IG-RY World Wide RTTY Contest', 'adifname' => 'IG-WW-RY', 'active' => 1),
			array('name' => 'INDEXA Worldwide QSO Party', 'adifname' => 'INDEXA-QSOP', 'active' => 1),
			array('name' => 'IRTS 2m Counties Contest', 'adifname' => 'IRTS-CONTEST', 'active' => 1),
			array('name' => 'IRTS 70cm Counties Contest', 'adifname' => 'IRTS-CONTEST', 'active' => 1),
			array('name' => 'IRTS 80m Counties Contest', 'adifname' => 'IRTS-80-CONTEST', 'active' => 1),
			array('name' => 'K1USN Slow Speed Test', 'adifname' => 'K1USNSST', 'active' => 1),
			array('name' => 'Kalbar Contest', 'adifname' => 'KALBAR CONTEST', 'active' => 1),
			array('name' => 'KANHAM Contest', 'adifname' => 'KANHAM', 'active' => 1),
			array('name' => 'KCJ Topband Contest', 'adifname' => 'KCJ-TOPBAND', 'active' => 1),
			array('name' => 'LABRE DX Contest', 'adifname' => 'LABRE-DX', 'active' => 1),
			array('name' => 'LABRE-RS Digi Contest', 'adifname' => 'CQWW-DIGI', 'active' => 1),
			array('name' => 'Makrothen RTTY Contest', 'adifname' => 'MAKROTHEN-RTTY', 'active' => 1),
			array('name' => 'Malaysia DX Contest', 'adifname' => 'MYDX-SSB-CONTEST', 'active' => 1),
			array('name' => 'Marconi Club ARI Loano QSO Party Day', 'adifname' => 'MCD-QSO-PARTY', 'active' => 1),
			array('name' => 'Marconi Club ARI Loano Slow CW QSO Party', 'adifname' => 'SLOW-CW-QSO-PARTY', 'active' => 1),
			array('name' => 'Marconi Memorial HF Contest', 'adifname' => 'MMC-HF-CW', 'active' => 1),
			array('name' => 'Maryland-DC QSO Party', 'adifname' => 'MDC-QSO-PARTY', 'active' => 1),
			array('name' => 'Mini-Test 40', 'adifname' => 'MINITEST-40', 'active' => 1),
			array('name' => 'Mini-Test 80', 'adifname' => 'MINITEST-80', 'active' => 1),
			array('name' => 'NCCC 55th Anniversary Fiesta', 'adifname' => 'NCCC-FIESTA', 'active' => 1),
			array('name' => 'NCCC FT4 Sprint', 'adifname' => 'NCCC-SPRINT-FT4', 'active' => 1),
			array('name' => 'NCCC Sprint', 'adifname' => 'NCCC-SPRINT-CW', 'active' => 1),
			array('name' => 'NCCC Sprint Ladder', 'adifname' => 'NCCC-SPRINT-CW', 'active' => 1),
			array('name' => 'North American Meteor Scatter Sprint', 'adifname' => 'VHF-NAMSS', 'active' => 1),
			array('name' => 'NRAU 10m Activity Contest', 'adifname' => 'NRAU-10', 'active' => 1),
			array('name' => 'NRRL MGM Weekend Contest', 'adifname' => 'NRRL-MGM', 'active' => 1),
			array('name' => 'NZART Memorial Contest', 'adifname' => 'MEMORIAL-CONTEST', 'active' => 1),
			array('name' => 'Old New Year Contest', 'adifname' => 'RADIO-ONY', 'active' => 1),
			array('name' => 'Pajajaran Bogor DX Contest', 'adifname' => 'PBDX-CONTEST', 'active' => 1),
			array('name' => 'Popov Memorial Contest', 'adifname' => 'RADIO-POPOV', 'active' => 1),
			array('name' => 'Portable Operations Challenge', 'adifname' => 'POC', 'active' => 1),
			array('name' => 'RAEM Contest', 'adifname' => 'RAEM', 'active' => 1),
			array('name' => 'RCC Cup', 'adifname' => 'RCC-CUP', 'active' => 1),
			array('name' => 'RSGB 80m Autumn Series, CW', 'adifname' => 'RSGB-80M-AUT', 'active' => 1),
			array('name' => 'RSGB 80m Autumn Series, Data', 'adifname' => 'RSGB-80M-AUT', 'active' => 1),
			array('name' => 'RSGB 80m Autumn Series, SSB', 'adifname' => 'RSGB-80M-AUT', 'active' => 1),
			array('name' => 'RSGB FT4 Contest', 'adifname' => 'RSGB-FT4', 'active' => 1),
			array('name' => 'RSGB FT4 International Activity Day', 'adifname' => 'RSGB-FT4', 'active' => 1),
			array('name' => 'RSGB Hope QSO Party', 'adifname' => 'RSGB-HQP', 'active' => 1),
			array('name' => 'RTTYOPS Weekend Sprint', 'adifname' => 'RTTYOPS-WEEKEND-SPRINT', 'active' => 1),
			array('name' => 'RTTYOPS Weeksprint', 'adifname' => 'RTTYOPS-WEEKSPRINT', 'active' => 1),
			array('name' => 'Russian 160-Meter DX Contest', 'adifname' => 'RADIO-160', 'active' => 1),
			array('name' => 'Russian PSK WW Contest', 'adifname' => 'RUS-WW-PSK', 'active' => 1),
			array('name' => 'Russian RTTY WW Contest', 'adifname' => 'RADIO-WW-RTTY', 'active' => 1),
			array('name' => 'Russian WW Digital Contest', 'adifname' => 'RUS-WW-DIGI', 'active' => 1),
			array('name' => 'Russian WW MultiMode Contest', 'adifname' => 'RUS-WW-MM', 'active' => 1),
			array('name' => 'Russion YL/OM Contest', 'adifname' => 'RADIO-YL-OM', 'active' => 1),
			array('name' => 'SARL HF CW Contest', 'adifname' => 'SARL-HF-CW', 'active' => 1),
			array('name' => 'SARL HF Digital Contest', 'adifname' => 'SARL-HF-DIGI', 'active' => 1),
			array('name' => 'SARL HF Phone Contest', 'adifname' => 'SARL-HF-SSB', 'active' => 1),
			array('name' => 'SARTG New Year RTTY Contest', 'adifname' => 'SARTG-NY-RTTY', 'active' => 1),
			array('name' => 'SCRY/RTTYOps WW DX RTTY Contest', 'adifname' => 'RTTYOPS-WW-RTTY', 'active' => 1),
			array('name' => 'SEC QSO Party', 'adifname' => 'SEC-QSO-PARTY', 'active' => 1),
			array('name' => 'Solar Eclipse QSO Party', 'adifname' => 'ECLIPSE-QSO', 'active' => 1),
			array('name' => 'South America 10 Meter Contest', 'adifname' => 'SA10M', 'active' => 1),
			array('name' => 'South American Integration Contest CW', 'adifname' => 'SACW', 'active' => 1),
			array('name' => 'Tennessee State Parks on the Air', 'adifname' => 'TNPOTA', 'active' => 1),
			array('name' => 'TESLA Memorial HF CW Contest', 'adifname' => 'TESLA-HF', 'active' => 1),
			array('name' => 'Texas State Parks on the Air', 'adifname' => 'TSPOTA', 'active' => 1),
			array('name' => 'Tipalayo DX Contest', 'adifname' => 'TIPALAYO DX CONTEST', 'active' => 1),
			array('name' => 'Tisza Cup CW Contest', 'adifname' => 'TISZACUP', 'active' => 1),
			array('name' => 'TRC Digi Contest', 'adifname' => 'TRC-DIGI', 'active' => 1),
			array('name' => 'TRC DX Contest', 'adifname' => 'TRC-DX', 'active' => 1),
			array('name' => 'Turkey HF SSB Contest', 'adifname' => 'TA-HF-SSB', 'active' => 1),
			array('name' => 'U.S. Islands QSO Party', 'adifname' => 'ISLAND-QSO-PARTY', 'active' => 1),
			array('name' => 'UA1DZ Memorial Cup', 'adifname' => 'ALRS-UA1DZ-CUP', 'active' => 1),
			array('name' => 'UBA ON Contest, 2m', 'adifname' => 'UBA-ON-2M', 'active' => 1),
			array('name' => 'UBA ON Contest, 6m', 'adifname' => 'UBA-ON-6M', 'active' => 1),
			array('name' => 'UBA ON Contest, CW', 'adifname' => 'UBA-ON-CW', 'active' => 1),
			array('name' => 'UBA ON Contest, SSB', 'adifname' => 'UBA-ON-SSB', 'active' => 1),
			array('name' => 'UBA PSK63 Prefix Contest', 'adifname' => 'UBA-PSK63-PREFIX', 'active' => 1),
			array('name' => 'UBA Spring Contest, 2m', 'adifname' => 'UBA-SPRING-CONTEST', 'active' => 1),
			array('name' => 'UBA Spring Contest, 6m', 'adifname' => 'UBA-SPRING-CONTEST', 'active' => 1),
			array('name' => 'UBA Spring Contest, CW', 'adifname' => 'UBA-SPRING-CONTEST', 'active' => 1),
			array('name' => 'UBA Spring Contest, SSB', 'adifname' => 'UBA-SPRING-CONTEST', 'active' => 1),
			array('name' => 'UFT QRP Contest', 'adifname' => 'UFT-QRP', 'active' => 1),
			array('name' => 'UK/EI DX Contest, CW', 'adifname' => 'UKEI-DX', 'active' => 1),
			array('name' => 'UK/EI DX Contest, SSB', 'adifname' => 'UKEI-DX', 'active' => 1),
			array('name' => 'UKEICC 80m Contest', 'adifname' => 'UKEICC-80M', 'active' => 1),
			array('name' => 'Ukrainian DX Classic RTTY Contest', 'adifname' => 'UR-DX-RTTY', 'active' => 1),
			array('name' => 'Ukrainian DX DIGI Contest', 'adifname' => 'UR-DX-DIGI', 'active' => 1),
			array('name' => 'UN DX Contest', 'adifname' => 'UN-DX', 'active' => 1),
			array('name' => 'URC DX RTTY Contest', 'adifname' => 'URCDX', 'active' => 1),
			array('name' => 'Vermont QSO Party', 'adifname' => 'VT-QSO-PARTY', 'active' => 1),
			array('name' => 'Washington State Salmon Run', 'adifname' => 'WA-SALMON-RUN', 'active' => 1),
			array('name' => 'Weekly RTTY Test', 'adifname' => 'WRT', 'active' => 1),
			array('name' => 'Worked All Provinces of China DX Contest', 'adifname' => 'WAPC-DX', 'active' => 1),
			array('name' => 'World Wide Argentina DX Contest', 'adifname' => 'WWPDX', 'active' => 1),
			array('name' => 'World Wide Holyland Contest', 'adifname' => 'WWHC', 'active' => 1),
			array('name' => 'Worldwide Sideband Activity Contest', 'adifname' => 'WWSAC', 'active' => 1),
			array('name' => 'WW PMC Contest', 'adifname' => 'WW-PMC', 'active' => 1),
			array('name' => 'YARC QSO Party', 'adifname' => 'YARC-QSO-PARTY', 'active' => 1),
			array('name' => 'YB DX Contest', 'adifname' => 'YB DX CONTEST', 'active' => 1),
			array('name' => 'YB DX RTTY Contest', 'adifname' => 'YB-DX-CONTEST', 'active' => 1),
			array('name' => 'YLRL YL-OM Contest', 'adifname' => 'YL-OM', 'active' => 1),
			array('name' => 'YOTA Contest', 'adifname' => 'YOTA', 'active' => 1),
			array('name' => 'Yuri Gagarin International DX Contest', 'adifname' => 'GC', 'active' => 1),
			array('name' => 'ZL Sprint', 'adifname' => 'ZL-SPRINT', 'active' => 1),
		);

		foreach ($contests as $contest) {
			$exists = $this->db->where('adifname', $contest['adifname'])
							->get('contest')
							->num_rows() > 0;

			if (!$exists) {
				$this->db->insert('contest', $contest);
			}
		}

	}

	public function down() {

		// Remove the contests added in this migration
		$contest_names = array(
			'10-10-SPRINT',
			'10-10-FALL-CW',
			'10-10-FALL-DIGITAL',
			'10-10-OPEN-SEASON',
			'10-10-SPRING-CW',
			'10-10-SPRING-DIGITAL',
			'10-10-SUMMER-PHONE',
			'10-10-WINTER-PHONE',
			'A1CLUB-AWT',
			'ALL-AFRICA',
			'AGCW-QRP',
			'ANZAC',
			'40-80',
			'ARRL-DIGI',
			'ARSI-VU-DX',
			'AC-QSO-PARTY',
			'WIA-AUSTRALIADAY',
			'BALKAN-HF',
			'BALTIC-CONTEST',
			'BUCURESTI-DIGITAL',
			'CP-QSO-PARTY',
			'CQP',
			'STAYHOME',
			'CQ-VHF-DIGI',
			'CQ-VHF-SSBCW',
			'CQMMDX',
			'9A-DX',
			'XMAS',
			'DIG-QSO-PARTY',
			'DIG-QSO-PARTY',
			'DRCG-WW-RTTY',
			'PACCDIGI',
			'EARTTY',
			'EANET-SPRINT',
			'EURASIA-CHAMP',
			'EUDXC',
			'F9AA-CW',
			'F9AA-DIGI',
			'F9AA-SSB',
			'FIRAC-CONTEST',
			'FRAPR-10M',
			'FT-CHALLENGE',
			'WWSA',
			'GUNUNGJATI',
			'HA3NS-SPRINT',
			'HAM-SPIRIT',
			'HAM-SPIRIT-SSB',
			'HARC-QSOP',
			'ARRL-HPM-150',
			'EA-MAJESTAD-CW',
			'EA-MAJESTAD-SSB',
			'ICWC-MST',
			'IG-WW-RY',
			'INDEXA-QSOP',
			'IRTS-CONTEST',
			'IRTS-CONTEST',
			'IRTS-80-CONTEST',
			'K1USNSST',
			'KALBAR CONTEST',
			'KANHAM',
			'KCJ-TOPBAND',
			'LABRE-DX',
			'CQWW-DIGI',
			'MAKROTHEN-RTTY',
			'MYDX-SSB-CONTEST',
			'MCD-QSO-PARTY',
			'SLOW-CW-QSO-PARTY',
			'MMC-HF-CW',
			'MDC-QSO-PARTY',
			'MINITEST-40',
			'MINITEST-80',
			'NCCC-FIESTA',
			'NCCC-SPRINT-FT4',
			'NCCC-SPRINT-CW',
			'NCCC-SPRINT-CW',
			'VHF-NAMSS',
			'NRAU-10',
			'NRRL-MGM',
			'MEMORIAL-CONTEST',
			'RADIO-ONY',
			'PBDX-CONTEST',
			'RADIO-POPOV',
			'POC',
			'RAEM',
			'RCC-CUP',
			'RSGB-80M-AUT',
			'RSGB-80M-AUT',
			'RSGB-80M-AUT',
			'RSGB-FT4',
			'RSGB-FT4',
			'RSGB-HQP',
			'RTTYOPS-WEEKEND-SPRINT',
			'RTTYOPS-WEEKSPRINT',
			'RADIO-160',
			'RUS-WW-PSK',
			'RADIO-WW-RTTY',
			'RUS-WW-DIGI',
			'RUS-WW-MM',
			'RADIO-YL-OM',
			'SARL-HF-CW',
			'SARL-HF-DIGI',
			'SARL-HF-SSB',
			'SARTG-NY-RTTY',
			'RTTYOPS-WW-RTTY',
			'SEC-QSO-PARTY',
			'ECLIPSE-QSO',
			'SA10M',
			'SACW',
			'TNPOTA',
			'TESLA-HF',
			'TSPOTA',
			'TIPALAYO DX CONTEST',
			'TISZACUP',
			'TRC-DIGI',
			'TRC-DX',
			'TA-HF-SSB',
			'ISLAND-QSO-PARTY',
			'ALRS-UA1DZ-CUP',
			'UBA-ON-2M',
			'UBA-ON-6M',
			'UBA-ON-CW',
			'UBA-ON-SSB',
			'UBA-PSK63-PREFIX',
			'UBA-SPRING-CONTEST',
			'UBA-SPRING-CONTEST',
			'UBA-SPRING-CONTEST',
			'UBA-SPRING-CONTEST',
			'UFT-QRP',
			'UKEI-DX',
			'UKEI-DX',
			'UKEICC-80M',
			'UR-DX-RTTY',
			'UR-DX-DIGI',
			'UN-DX',
			'URCDX',
			'VT-QSO-PARTY',
			'WA-SALMON-RUN',
			'WRT',
			'WAPC-DX',
			'WWPDX',
			'WWHC',
			'WWSAC',
			'WW-PMC',
			'YARC-QSO-PARTY',
			'YB DX CONTEST',
			'YB-DX-CONTEST',
			'YL-OM',
			'YOTA',
			'GC',
			'ZL-SPRINT',
		);

		$this->db->where_in('adifname', $contest_names);
		$this->db->delete('contest');
	}
}
