ALTER TABLE `config` ADD `section` ENUM( 'system', 'conference' ) NOT NULL;
ALTER TABLE `config` ADD `conferencetypes` SET( 'sciencefair', 'scienceolympics' ) NULL DEFAULT NULL;
UPDATE config SET `section`='system' WHERE `category`='Committee Members' AND var='committee_personal_fields';
UPDATE config SET `section`='system' WHERE `category`='Committee Members' AND var='committee_personal_required';
UPDATE config SET `section`='system' WHERE `category`='Feeder Fairs' AND var='fairs_name';
UPDATE config SET `section`='system' WHERE `category`='Fundraising' AND var='charity_number';
UPDATE config SET `section`='system' WHERE `category`='Fundraising' AND var='fiscal_yearend';
UPDATE config SET `section`='system' WHERE `category`='Fundraising' AND var='registered_charity';
UPDATE config SET `section`='system' WHERE `category`='Global' AND var='committee_publiclayout';
UPDATE config SET `section`='system' WHERE `category`='Global' AND var='default_language';
UPDATE config SET `section`='system' WHERE `category`='Global' AND var='fairmanageremail';
UPDATE config SET `section`='system' WHERE `category`='Global' AND var='fairname';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Global' AND var='filterdivisionbycategory';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Global' AND var='project_num_format';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Global' AND var='project_sort_format';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Global' AND var='winners_show_prize_amounts';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Judge Registration' AND var='judges_availability_enable';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Judge Registration' AND var='judges_password_expiry_days';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Judge Registration' AND var='judges_specialaward_enable';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Judge Registration' AND var='judges_specialaward_max';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Judge Registration' AND var='judges_specialaward_min';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Judge Registration' AND var='judges_specialaward_only_enable';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Judge Registration' AND var='judge_personal_fields';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Judge Registration' AND var='judge_personal_required';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Judge Registration' AND var='judge_registration_singlepassword';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Judge Registration' AND var='judge_registration_type';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Judge Registration' AND var='maxjudgeage';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Judge Registration' AND var='minjudgeage';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Judge Scheduler' AND var='effort';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Judge Scheduler' AND var='max_judges_per_team';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Judge Scheduler' AND var='max_projects_per_team';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Judge Scheduler' AND var='min_judges_per_team';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Judge Scheduler' AND var='projects_per_special_award_judge';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Judge Scheduler' AND var='project_status';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Judge Scheduler' AND var='scheduler_enable_sa_scheduling';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Judge Scheduler' AND var='times_judged';
UPDATE config SET `section`='system' WHERE `category`='Localization' AND var='country';
UPDATE config SET `section`='system' WHERE `category`='Localization' AND var='dateformat';
UPDATE config SET `section`='system' WHERE `category`='Localization' AND var='postalzip';
UPDATE config SET `section`='system' WHERE `category`='Localization' AND var='provincestate';
UPDATE config SET `section`='system' WHERE `category`='Localization' AND var='timeformat';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Participant Registration' AND var='maxage';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Participant Registration' AND var='maxgrade';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='maxmentorsperproject';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='maxspecialawardsperproject';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='maxstudentsperproject';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Participant Registration' AND var='minage';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Participant Registration' AND var='mingrade';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='minmentorsperproject';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='minstudentsperproject';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='participant_mentor';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='participant_project_electricity';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='participant_project_summary_wordmax';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='participant_project_summary_wordmin';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='participant_project_table';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='participant_project_title_charmax';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Participant Registration' AND var='participant_regfee_items_enable';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Participant Registration' AND var='participant_registration_singlepassword';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Participant Registration' AND var='participant_registration_type';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='participant_short_title_charmax';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='participant_short_title_enable';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Participant Registration' AND var='participant_student_foodreq';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Participant Registration' AND var='participant_student_personal';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Participant Registration' AND var='participant_student_pronunciation';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Participant Registration' AND var='participant_student_tshirt';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Participant Registration' AND var='participant_student_tshirt_cost';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='regfee';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='regfee_per';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='regfee_show_info';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='specialawardnomination';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='specialawardnomination_aftersignatures';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Participant Registration' AND var='usedivisionselector';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Reports' AND var='reports_show_criteria';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Reports' AND var='reports_show_unawarded_awards';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Reports' AND var='reports_show_unawarded_prizes';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Science Fairs' AND var='fairs_allow_login';
UPDATE config SET `section`='conference', conferencetypes='sciencefair' WHERE `category`='Science Fairs' AND var='fairs_enable';
UPDATE config SET `section`='system' WHERE `category`='Special' AND var='DBVERSION';
UPDATE config SET `section`='system' WHERE `category`='Special' AND var='emailqueue_lock';
UPDATE config SET `section`='system' WHERE `category`='Special' AND var='FAIRYEAR';
UPDATE config SET `section`='system' WHERE `category`='Special' AND var='FISCALYEAR';
UPDATE config SET `section`='system' WHERE `category`='Special' AND var='judge_scheduler_activity';
UPDATE config SET `section`='system' WHERE `category`='Special' AND var='judge_scheduler_percent';
UPDATE config SET `section`='system' WHERE `category`='Special' AND var='SFIABDIRECTORY';
UPDATE config SET `section`='system' WHERE `category`='Sponsors' AND var='sponsor_personal_fields';
UPDATE config SET `section`='system' WHERE `category`='Sponsors' AND var='sponsor_personal_required';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Tour Assigner' AND var='tours_assigner_activity';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Tour Assigner' AND var='tours_assigner_effort';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Tour Assigner' AND var='tours_assigner_percent';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Tours' AND var='tours_choices_max';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Tours' AND var='tours_choices_min';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Tours' AND var='tours_enable';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Volunteer Registration' AND var='volunteer_enable';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Volunteer Registration' AND var='volunteer_password_expiry_days';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Volunteer Registration' AND var='volunteer_personal_fields';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Volunteer Registration' AND var='volunteer_personal_required';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Volunteer Registration' AND var='volunteer_registration_singlepassword';
UPDATE config SET `section`='conference', conferencetypes='sciencefair,scienceolympics' WHERE `category`='Volunteer Registration' AND var='volunteer_registration_type';
UPDATE config SET `section`='system', category='Global' WHERE var='theme';
UPDATE config SET `section`='system', category='Global' WHERE var='theme_icons';
UPDATE config SET conferences_id=-1 WHERE year=-1;
UPDATE config SET conferences_id=0 WHERE year=0;
ALTER TABLE `config` ADD UNIQUE ( `var` , `conferences_id`);
ALTER TABLE `config` DROP INDEX var;
