DROP TABLE IF EXISTS tmux;
CREATE TABLE tmux (
	ID int(10) unsigned NOT NULL AUTO_INCREMENT,
	setting varchar(64) COLLATE utf8_unicode_ci NOT NULL,
	value varchar(19000) COLLATE utf8_unicode_ci DEFAULT NULL,
	updateddate timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
	PRIMARY KEY (ID),
	UNIQUE KEY setting (setting)
) ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

INSERT INTO tmux (setting, value) values ('defrag_cache','900'),
	('monitor_delay','30'),
	('tmux_session','newznab'),
	('niceness','19'),
	('binaries','0'),
    ('maxbinaries', '10000'),
	('backfill','0'),
	('import','0'),
	('nzbs','/path/to/nzbs'),
	('running','0'),
	('sequential','0'),
	('nfos','0'),
	('post','0'),
	('releases','0'),
	('releases_threaded','0'),
	('fix_names','0'),
	('seq_timer','30'),
	('bins_timer','30'),
	('back_timer','30'),
	('import_timer','30'),
	('rel_timer','30'),
	('fix_timer','30'),
	('post_timer','30'),
	('import_bulk','0'),
	('backfill_qty','100000'),
	('collections_kill','0'),
	('postprocess_kill','0'),
	('crap_timer','30'),
	('fix_crap','0'),
	('tv_timer','43200'),
	('update_tv','0'),
	('htop','0'),
	('nmon','0'),
	('bwmng','0'),
	('mytop','0'),
	('console','0'),
	('vnstat','0'),
	('vnstat_args',NULL),
	('tcptrack','0'),
	('tcptrack_args','-i eth0 port 443'),
	('backfill_groups','4'),
	('post_kill_timer','300'),
	('optimize','0'),
	('optimize_timer','86400'),
	('monitor_path', NULL),
	('write_logs','0'),
	('sorter','0'),
	('sorter_timer', 30),
	('powerline','0'),
	('patchdb','0'),
	('patchdb_timer','21600'),
	('progressive','0'),
	('dehash', '0'),
	('dehash_timer','30'),
	('backfill_order','2'),
	('backfill_days', '1'),
	('post_amazon', '0'),
    ('amazonsleep', 1000),
	('post_non', '0'),
	('post_timer_amazon', '30'),
	('post_timer_non', '30'),
	('colors_start', '1'),
	('colors_end', '250'),
	('colors_exc', '4, 8, 9, 11, 15, 16, 17, 18, 19, 46, 47, 48, 49, 50, 51, 52, 53, 59, 60'),
	('monitor_path_a', NULL),
	('monitor_path_b', NULL),
	('colors', '0'),
	('showquery', '0'),
	('fix_crap_opt', 'Disabled'),
	('showprocesslist', '0'),
	('processupdate', '2'),
    ('maxaddprocessed', 25),
	('maxnfoprocessed', 100),
	('maxrageprocessed', 75),
	('maximdbprocessed', 100),
	('maxanidbprocessed', 100),
	('maxmusicprocessed', 150),
	('maxgamesprocessed', 150),
	('maxbooksprocessed', 300),
	('maxnzbsprocessed', 1000),
	('maxpartrepair', 15000),
	('binarythreads', 1),
	('backfillthreads', 1),
	('postthreads', 1),
	('releasethreads', 1),
	('nzbthreads', 1),
    ('maxmssgs', 20000),
	('maxsizetopostprocess', 100),
    ('postthreadsamazon', '1'),
	('postthreadsnon', '1'),
	('currentppticket', '0'),
	('nextppticket', '0'),
    ('segmentstodownload', '2'),
    ('passchkattempts', 1),
    ('maxpartsprocessed', 3),
    ('debuginfo', 0),
    ('request_url', 'http://predb_irc.nzedb.com/predb_irc.php?reqid=[REQUEST_ID]&group=[GROUP_NM]'),
	('lookup_reqids', '1'),
    ('lookup_reqids_threaded', '1'),
    ('sphinx', '0'),
    ('sphinx_timer', '600'),
    ('delete_parts', '0'),
    ('delete_timer', '600'),
    ('movie_timer', '43200'),
    ('fetch_movie', '0'),
    ('unwanted', '0'),
    ('others', '0'),
    ('spotnab', '0'),
    ('spotnab_timer', '600'),
    ('predb', '0'),
    ('predb_timer', '600'),
	('request_hours', '1'),
    ('lookuppar2','0'),
    ('addpar2', '0'),
	('fixnamethreads', '1'),
	('fixnamesperrun', '10'),
    ('sqlpatch','0');

DROP TABLE IF EXISTS country;
CREATE TABLE country (
	ID INT(11) NOT NULL AUTO_INCREMENT,
	name VARCHAR(255) NOT NULL DEFAULT "",
	code CHAR(2) NOT NULL DEFAULT "",
	PRIMARY KEY (ID)
) ENGINE=INNODB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci AUTO_INCREMENT=1 ;

CREATE INDEX ix_country_name ON country(name);

INSERT INTO country (code, name) VALUES ( 'AF', 'Afghanistan' ),
	( 'AX', 'Aland Islands' ),
	( 'AL', 'Albania' ),
	( 'DZ', 'Algeria' ),
	( 'AS', 'American Samoa' ),
	( 'AD', 'Andorra' ),
	( 'AO', 'Angola' ),
	( 'AI', 'Anguilla' ),
	( 'AQ', 'Antarctica' ),
	( 'AG', 'Antigua and Barbuda' ),
	( 'AR', 'Argentina' ),
	( 'AM', 'Armenia' ),
	( 'AW', 'Aruba' ),
	( 'AU', 'Australia' ),
	( 'AT', 'Austria' ),
	( 'AZ', 'Azerbaijan' ),
	( 'BS', 'Bahamas' ),
	( 'BH', 'Bahrain' ),
	( 'BD', 'Bangladesh' ),
	( 'BB', 'Barbados' ),
	( 'BY', 'Belarus' ),
	( 'BE', 'Belgium' ),
	( 'BZ', 'Belize' ),
	( 'BJ', 'Benin' ),
	( 'BM', 'Bermuda' ),
	( 'BT', 'Bhutan' ),
	( 'BO', 'Bolivia' ),
	( 'BA', 'Bosnia and Herzegovina' ),
	( 'BW', 'Botswana' ),
	( 'BV', 'Bouvetoya' ),
	( 'BR', 'Brazil' ),
	( 'VG', 'British Virgin Islands' ),
	( 'BN', 'Brunei Darussalam' ),
	( 'BG', 'Bulgaria' ),
	( 'BF', 'Burkina Faso' ),
	( 'BI', 'Burundi' ),
	( 'KH', 'Cambodia' ),
	( 'CM', 'Cameroon' ),
	( 'CA', 'Canada' ),
	( 'CV', 'Cape Verde' ),
	( 'KY', 'Cayman Islands' ),
	( 'CF', 'Central African Republic' ),
	( 'TD', 'Chad' ),
	( 'CL', 'Chile' ),
	( 'CN', 'China' ),
	( 'CX', 'Christmas Island' ),
	( 'CC', 'Cocos (Keeling) Islands' ),
	( 'CO', 'Colombia' ),
	( 'KM', 'Comoros the' ),
	( 'CD', 'Congo' ),
	( 'CG', 'Congo the' ),
	( 'CK', 'Cook Islands' ),
	( 'CR', 'Costa Rica' ),
	( 'CI', 'Cote d\'Ivoire' ),
	( 'HR', 'Croatia' ),
	( 'CU', 'Cuba' ),
	( 'CY', 'Cyprus' ),
	( 'CZ', 'Czech Republic' ),
	( 'DK', 'Denmark' ),
	( 'DJ', 'Djibouti' ),
	( 'DM', 'Dominica' ),
	( 'DO', 'Dominican Republic' ),
	( 'EC', 'Ecuador' ),
	( 'EG', 'Egypt' ),
	( 'SV', 'El Salvador' ),
	( 'GQ', 'Equatorial Guinea' ),
	( 'ER', 'Eritrea' ),
	( 'EE', 'Estonia' ),
	( 'ET', 'Ethiopia' ),
	( 'FO', 'Faroe Islands' ),
	( 'FK', 'Falkland Islands' ),
	( 'FJ', 'Fiji' ),
	( 'FI', 'Finland' ),
	( 'FR', 'France' ),
	( 'GF', 'French Guiana' ),
	( 'PF', 'French Polynesia' ),
	( 'GA', 'Gabon' ),
	( 'GM', 'Gambia' ),
	( 'GE', 'Georgia' ),
	( 'DE', 'Germany' ),
	( 'GH', 'Ghana' ),
	( 'GI', 'Gibraltar' ),
	( 'GR', 'Greece' ),
	( 'GL', 'Greenland' ),
	( 'GD', 'Grenada' ),
	( 'GP', 'Guadeloupe' ),
	( 'GU', 'Guam' ),
	( 'GT', 'Guatemala' ),
	( 'GG', 'Guernsey' ),
	( 'GN', 'Guinea' ),
	( 'GW', 'Guinea-Bissau' ),
	( 'GY', 'Guyana' ),
	( 'HT', 'Haiti' ),
	( 'HN', 'Honduras' ),
	( 'HK', 'Hong Kong' ),
	( 'HU', 'Hungary' ),
	( 'IS', 'Iceland' ),
	( 'IN', 'India' ),
	( 'ID', 'Indonesia' ),
	( 'IR', 'Iran' ),
	( 'IQ', 'Iraq' ),
	( 'IE', 'Ireland' ),
	( 'IM', 'Isle of Man' ),
	( 'IL', 'Israel' ),
	( 'IT', 'Italy' ),
	( 'JM', 'Jamaica' ),
	( 'JP', 'Japan' ),
	( 'JE', 'Jersey' ),
	( 'JO', 'Jordan' ),
	( 'KZ', 'Kazakhstan' ),
	( 'KE', 'Kenya' ),
	( 'KI', 'Kiribati' ),
	( 'KP', 'Korea' ),
	( 'KR', 'Korea' ),
	( 'KW', 'Kuwait' ),
	( 'KG', 'Kyrgyz Republic' ),
	( 'LA', 'Lao' ),
	( 'LV', 'Latvia' ),
	( 'LB', 'Lebanon' ),
	( 'LS', 'Lesotho' ),
	( 'LR', 'Liberia' ),
	( 'LY', 'Libyan Arab Jamahiriya' ),
	( 'LI', 'Liechtenstein' ),
	( 'LT', 'Lithuania' ),
	( 'LU', 'Luxembourg' ),
	( 'MO', 'Macao' ),
	( 'MK', 'Macedonia' ),
	( 'MG', 'Madagascar' ),
	( 'MW', 'Malawi' ),
	( 'MY', 'Malaysia' ),
	( 'MV', 'Maldives' ),
	( 'ML', 'Mali' ),
	( 'MT', 'Malta' ),
	( 'MH', 'Marshall Islands' ),
	( 'MQ', 'Martinique' ),
	( 'MR', 'Mauritania' ),
	( 'MU', 'Mauritius' ),
	( 'YT', 'Mayotte' ),
	( 'MX', 'Mexico' ),
	( 'FM', 'Micronesia' ),
	( 'MD', 'Moldova' ),
	( 'MC', 'Monaco' ),
	( 'MN', 'Mongolia' ),
	( 'ME', 'Montenegro' ),
	( 'MS', 'Montserrat' ),
	( 'MA', 'Morocco' ),
	( 'MZ', 'Mozambique' ),
	( 'MM', 'Myanmar' ),
	( 'NA', 'Namibia' ),
	( 'NR', 'Nauru' ),
	( 'NP', 'Nepal' ),
	( 'AN', 'Netherlands Antilles' ),
	( 'NL', 'Netherlands' ),
	( 'NC', 'New Caledonia' ),
	( 'NZ', 'New Zealand' ),
	( 'NI', 'Nicaragua' ),
	( 'NE', 'Niger' ),
	( 'NG', 'Nigeria' ),
	( 'NU', 'Niue' ),
	( 'NF', 'Norfolk Island' ),
	( 'MP', 'Northern Mariana Islands' ),
	( 'NO', 'Norway' ),
	( 'OM', 'Oman' ),
	( 'PK', 'Pakistan' ),
	( 'PW', 'Palau' ),
	( 'PS', 'Palestinian Territory' ),
	( 'PA', 'Panama' ),
	( 'PG', 'Papua New Guinea' ),
	( 'PY', 'Paraguay' ),
	( 'PE', 'Peru' ),
	( 'PH', 'Philippines' ),
	( 'PN', 'Pitcairn Islands' ),
	( 'PL', 'Poland' ),
	( 'PT', 'Portugal' ),
	( 'PR', 'Puerto Rico' ),
	( 'QA', 'Qatar' ),
	( 'RE', 'Reunion' ),
	( 'RO', 'Romania' ),
	( 'RU', 'Russian Federation' ),
	( 'RW', 'Rwanda' ),
	( 'BL', 'Saint Barthelemy' ),
	( 'SH', 'Saint Helena' ),
	( 'KN', 'Saint Kitts' ),
	( 'LC', 'Saint Lucia' ),
	( 'MF', 'Saint Martin' ),
	( 'PM', 'Saint Pierre' ),
	( 'VC', 'Saint Vincent' ),
	( 'WS', 'Samoa' ),
	( 'SM', 'San Marino' ),
	( 'ST', 'Sao Tome' ),
	( 'SA', 'Saudi Arabia' ),
	( 'SN', 'Senegal' ),
	( 'RS', 'Serbia' ),
	( 'SC', 'Seychelles' ),
	( 'SL', 'Sierra Leone' ),
	( 'SG', 'Singapore' ),
	( 'SK', 'Slovakia' ),
	( 'SI', 'Slovenia' ),
	( 'SB', 'Solomon Islands' ),
	( 'SO', 'Somalia' ),
	( 'ZA', 'South Africa' ),
	( 'ES', 'Spain' ),
	( 'LK', 'Sri Lanka' ),
	( 'SD', 'Sudan' ),
	( 'SR', 'Suriname' ),
	( 'SZ', 'Swaziland' ),
	( 'SE', 'Sweden' ),
	( 'CH', 'Switzerland' ),
	( 'SY', 'Syrian Arab Republic' ),
	( 'TW', 'Taiwan' ),
	( 'TJ', 'Tajikistan' ),
	( 'TZ', 'Tanzania' ),
	( 'TH', 'Thailand' ),
	( 'TL', 'Timor-Leste' ),
	( 'TG', 'Togo' ),
	( 'TK', 'Tokelau' ),
	( 'TO', 'Tonga' ),
	( 'TT', 'Trinidad and Tobago' ),
	( 'TN', 'Tunisia' ),
	( 'TR', 'Turkey' ),
	( 'TM', 'Turkmenistan' ),
	( 'TV', 'Tuvalu' ),
	( 'UG', 'Uganda' ),
	( 'UA', 'Ukraine' ),
	( 'AE', 'United Arab Emirates' ),
	( 'GB', 'United Kingdom' ),
	( 'US', 'United States' ),
	( 'VI', 'United States Virgin Islands' ),
	( 'UY', 'Uruguay' ),
	( 'UZ', 'Uzbekistan' ),
	( 'VU', 'Vanuatu' ),
	( 'VE', 'Venezuela' ),
	( 'VN', 'Vietnam' ),
	( 'WF', 'Wallis and Futuna' ),
	( 'EH', 'Western Sahara' ),
	( 'YE', 'Yemen' ),
	( 'ZM', 'Zambia' ),
	( 'ZW', 'Zimbabwe' );