ALTER TABLE `site` ADD `user_username_change` tinyint null;

ALTER TABLE `site` ADD `site_template` varchar(25) null;

ALTER TABLE `columns` ADD `meta_browse_fields` text null;

ALTER TABLE `columns` ADD `split_text` varchar(50) null;
ALTER TABLE `users` ADD `is_public` tinyint DEFAULT 0;
ALTER TABLE `settings` ADD `s_static_options` text NULL;
ALTER TABLE `site` MODIFY COLUMN `player` ENUM('waveformPlayer', 'flash','quicktime','universal','qtSimple','flowPlayer','flashMp3Player','xspfPlayerSlim','originalSingle','jwPlayer') NOT NULL DEFAULT 'html5full' COMMENT 'The embedded media player to use for audition playback.';
ALTER TABLE `users` MODIFY COLUMN `player` ENUM('waveformPlayer', 'flash','quicktime','universal','qtSimple','flowPlayer','flashMp3Player','xspfPlayerSlim','originalSingle','jwPlayer') NOT NULL DEFAULT 'html5full' COMMENT 'The embedded media player to use for audition playback per user.';

CREATE TABLE IF NOT EXISTS `quick_search_options` (
 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
 `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
 `search_criteria` varchar(1000) DEFAULT NULL,
 `description` varchar(1000) NOT NULL,
 `playlist_id` int(11) DEFAULT NULL,
 PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=356 DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `static_search_options` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `search_criteria` varchar(1000) NULL,
  `description` varchar(1000) NOT NULL,
  `category` varchar(25) NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=363 DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `widgets` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `key_code` varchar(25) NOT NULL,
  `json` varchar(500) DEFAULT NULL,
  `active` int(10) unsigned DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uidx_widgets_key_code` (`key_code`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

ALTER TABLE `settings` ADD `s_static_options` text NULL;
ALTER TABLE `static_search_options` ADD `category` varchar(25) null;
ALTER TABLE `users` ADD `date_registered` timestamp DEFAULT CURRENT_TIMESTAMP;
ALTER TABLE `onepages` ADD `general_notes` text null;
ALTER TABLE `onepages` ADD `sort_order_rename` tinyint null;
ALTER TABLE `site` MODIFY COLUMN `player` ENUM('flashV2','waveformPlayer','flash','quicktime','universal','qtSimple','flowPlayer','flashMp3Player','xspfPlayerSlim','originalSingle','jwPlayer','resizableMp3Player') NOT NULL DEFAULT 'html5full' COMMENT 'The embedded media player to use for audition playback';
ALTER TABLE `users` MODIFY COLUMN `player` ENUM('flashV2','waveformPlayer','flash','quicktime','universal','qtSimple','flowPlayer','flashMp3Player','xspfPlayerSlim','originalSingle','jwPlayer','resizableMp3Player') NOT NULL DEFAULT 'html5full' COMMENT 'The embedded media player to use for audition playback.';
ALTER TABLE `users` add `notes` text null;
ALTER TABLE `users` add `address1` varchar(100) null;
ALTER TABLE `users` add `address2` varchar(100) null;
ALTER TABLE `users` add `city` varchar(50) null;
ALTER TABLE `users` add `region` varchar(50) null;
ALTER TABLE `users` add `postal_code` varchar(30) null;
ALTER TABLE `users` add `phone_fax` varchar(50) null;
ALTER TABLE `users` add `phone_cell` varchar(50) null;
ALTER TABLE `users` add `contract_owner` varchar(50) null;
ALTER TABLE `users` add `contract_type` varchar(50) null;
ALTER TABLE `users` add `related_contact_id` varchar(50) null;
ALTER TABLE `users` add `business_type` varchar(50) null;
ALTER TABLE `users` add `first_name` varchar(50) null;
ALTER TABLE `users` add `last_name` varchar(50) null;
ALTER TABLE `users` add `original_external_imported_id` varchar(30) null;
ALTER TABLE `users` add `job_title` varchar(50) null;
ALTER TABLE `users` add `date_registered` datetime null;
ALTER TABLE `users` add `sales_person` tinyint(1) null;
ALTER TABLE `users` add `rep_selected` int(4) null;
ALTER TABLE `log` add `ctrl_name` varchar(15) null;
ALTER TABLE `log` add `ctrl_related_id` int(4) null;
ALTER TABLE `settings` add `s_panel_selected` tinyint(1) default 0;
ALTER TABLE `settings` add `s_selective_show` tinyint(1) default 0;
ALTER TABLE `settings` add `u_selective_show` tinyint(1) default 0;
ALTER TABLE `onepages` add `general_notes` text null;
ALTER TABLE `onepages` add `sort_order_rename` tinyint null;
ALTER TABLE `countries` add `iso_two_chars` varchar(2) null;
ALTER TABLE `countries` add `custom_order` int(4) null;
ALTER TABLE `playlists` add `status` tinyint(1) null;
ALTER TABLE `playlists` add `status_id` int(4) null;
ALTER TABLE `playlists` add `rate_id` int(4) null;
ALTER TABLE `playlists` add `clearance_id` int(4) null;
ALTER TABLE `playlists` add `market_id` int(4) null;
ALTER TABLE `widgets` modify column `json` text null;

UPDATE `countries` set iso_two_chars ='af' where iso ='afg';
UPDATE `countries` set iso_two_chars ='ax' where iso ='ala';
UPDATE `countries` set iso_two_chars ='al' where iso ='alb';
UPDATE `countries` set iso_two_chars ='dz' where iso ='dza';
UPDATE `countries` set iso_two_chars ='as' where iso ='asm';
UPDATE `countries` set iso_two_chars ='ad' where iso ='and';
UPDATE `countries` set iso_two_chars ='ao' where iso ='ago';
UPDATE `countries` set iso_two_chars ='ai' where iso ='aia';
UPDATE `countries` set iso_two_chars ='aq' where iso ='ata';
UPDATE `countries` set iso_two_chars ='ag' where iso ='atg';
UPDATE `countries` set iso_two_chars ='ar' where iso ='arg';
UPDATE `countries` set iso_two_chars ='am' where iso ='arm';
UPDATE `countries` set iso_two_chars ='aw' where iso ='abw';
UPDATE `countries` set iso_two_chars ='au' where iso ='aus';
UPDATE `countries` set iso_two_chars ='at' where iso ='aut';
UPDATE `countries` set iso_two_chars ='az' where iso ='aze';
UPDATE `countries` set iso_two_chars ='bs' where iso ='bhs';
UPDATE `countries` set iso_two_chars ='bh' where iso ='bhr';
UPDATE `countries` set iso_two_chars ='bd' where iso ='bgd';
UPDATE `countries` set iso_two_chars ='bb' where iso ='brb';
UPDATE `countries` set iso_two_chars ='by' where iso ='blr';
UPDATE `countries` set iso_two_chars ='be' where iso ='bel';
UPDATE `countries` set iso_two_chars ='bz' where iso ='blz';
UPDATE `countries` set iso_two_chars ='bj' where iso ='ben';
UPDATE `countries` set iso_two_chars ='bm' where iso ='bmu';
UPDATE `countries` set iso_two_chars ='bt' where iso ='btn';
UPDATE `countries` set iso_two_chars ='bo' where iso ='bol';
UPDATE `countries` set iso_two_chars ='bq' where iso ='bes';
UPDATE `countries` set iso_two_chars ='ba' where iso ='bih';
UPDATE `countries` set iso_two_chars ='bw' where iso ='bwa';
UPDATE `countries` set iso_two_chars ='bv' where iso ='bvt';
UPDATE `countries` set iso_two_chars ='br' where iso ='bra';
UPDATE `countries` set iso_two_chars ='io' where iso ='iot';
UPDATE `countries` set iso_two_chars ='bn' where iso ='brn';
UPDATE `countries` set iso_two_chars ='bg' where iso ='bgr';
UPDATE `countries` set iso_two_chars ='bf' where iso ='bfa';
UPDATE `countries` set iso_two_chars ='bi' where iso ='bdi';
UPDATE `countries` set iso_two_chars ='kh' where iso ='khm';
UPDATE `countries` set iso_two_chars ='cm' where iso ='cmr';
UPDATE `countries` set iso_two_chars ='ca' where iso ='can';
UPDATE `countries` set iso_two_chars ='cv' where iso ='cpv';
UPDATE `countries` set iso_two_chars ='ky' where iso ='cym';
UPDATE `countries` set iso_two_chars ='cf' where iso ='caf';
UPDATE `countries` set iso_two_chars ='td' where iso ='tcd';
UPDATE `countries` set iso_two_chars ='cl' where iso ='chl';
UPDATE `countries` set iso_two_chars ='cn' where iso ='chn';
UPDATE `countries` set iso_two_chars ='cx' where iso ='cxr';
UPDATE `countries` set iso_two_chars ='cc' where iso ='cck';
UPDATE `countries` set iso_two_chars ='co' where iso ='col';
UPDATE `countries` set iso_two_chars ='km' where iso ='com';
UPDATE `countries` set iso_two_chars ='cg' where iso ='cog';
UPDATE `countries` set iso_two_chars ='cd' where iso ='cod';
UPDATE `countries` set iso_two_chars ='ck' where iso ='cok';
UPDATE `countries` set iso_two_chars ='cr' where iso ='cri';
UPDATE `countries` set iso_two_chars ='ci' where iso ='civ';
UPDATE `countries` set iso_two_chars ='hr' where iso ='hrv';
UPDATE `countries` set iso_two_chars ='cu' where iso ='cub';
UPDATE `countries` set iso_two_chars ='cw' where iso ='cuw';
UPDATE `countries` set iso_two_chars ='cy' where iso ='cyp';
UPDATE `countries` set iso_two_chars ='cz' where iso ='cze';
UPDATE `countries` set iso_two_chars ='dk' where iso ='dnk';
UPDATE `countries` set iso_two_chars ='dj' where iso ='dji';
UPDATE `countries` set iso_two_chars ='dm' where iso ='dma';
UPDATE `countries` set iso_two_chars ='do' where iso ='dom';
UPDATE `countries` set iso_two_chars ='ec' where iso ='ecu';
UPDATE `countries` set iso_two_chars ='eg' where iso ='egy';
UPDATE `countries` set iso_two_chars ='sv' where iso ='slv';
UPDATE `countries` set iso_two_chars ='gq' where iso ='gnq';
UPDATE `countries` set iso_two_chars ='er' where iso ='eri';
UPDATE `countries` set iso_two_chars ='ee' where iso ='est';
UPDATE `countries` set iso_two_chars ='et' where iso ='eth';
UPDATE `countries` set iso_two_chars ='fk' where iso ='flk';
UPDATE `countries` set iso_two_chars ='fo' where iso ='fro';
UPDATE `countries` set iso_two_chars ='fj' where iso ='fji';
UPDATE `countries` set iso_two_chars ='fi' where iso ='fin';
UPDATE `countries` set iso_two_chars ='fr' where iso ='fra';
UPDATE `countries` set iso_two_chars ='gf' where iso ='guf';
UPDATE `countries` set iso_two_chars ='pf' where iso ='pyf';
UPDATE `countries` set iso_two_chars ='tf' where iso ='atf';
UPDATE `countries` set iso_two_chars ='ga' where iso ='gab';
UPDATE `countries` set iso_two_chars ='gm' where iso ='gmb';
UPDATE `countries` set iso_two_chars ='ge' where iso ='geo';
UPDATE `countries` set iso_two_chars ='de' where iso ='deu';
UPDATE `countries` set iso_two_chars ='gh' where iso ='gha';
UPDATE `countries` set iso_two_chars ='gi' where iso ='gib';
UPDATE `countries` set iso_two_chars ='gr' where iso ='grc';
UPDATE `countries` set iso_two_chars ='gl' where iso ='grl';
UPDATE `countries` set iso_two_chars ='gd' where iso ='grd';
UPDATE `countries` set iso_two_chars ='gp' where iso ='glp';
UPDATE `countries` set iso_two_chars ='gu' where iso ='gum';
UPDATE `countries` set iso_two_chars ='gt' where iso ='gtm';
UPDATE `countries` set iso_two_chars ='gg' where iso ='ggy';
UPDATE `countries` set iso_two_chars ='gn' where iso ='gin';
UPDATE `countries` set iso_two_chars ='gw' where iso ='gnb';
UPDATE `countries` set iso_two_chars ='gy' where iso ='guy';
UPDATE `countries` set iso_two_chars ='ht' where iso ='hti';
UPDATE `countries` set iso_two_chars ='hm' where iso ='hmd';
UPDATE `countries` set iso_two_chars ='va' where iso ='vat';
UPDATE `countries` set iso_two_chars ='hn' where iso ='hnd';
UPDATE `countries` set iso_two_chars ='hk' where iso ='hkg';
UPDATE `countries` set iso_two_chars ='hu' where iso ='hun';
UPDATE `countries` set iso_two_chars ='is' where iso ='isl';
UPDATE `countries` set iso_two_chars ='in' where iso ='ind';
UPDATE `countries` set iso_two_chars ='id' where iso ='idn';
UPDATE `countries` set iso_two_chars ='ir' where iso ='irn';
UPDATE `countries` set iso_two_chars ='iq' where iso ='irq';
UPDATE `countries` set iso_two_chars ='ie' where iso ='irl';
UPDATE `countries` set iso_two_chars ='im' where iso ='imn';
UPDATE `countries` set iso_two_chars ='il' where iso ='isr';
UPDATE `countries` set iso_two_chars ='it' where iso ='ita';
UPDATE `countries` set iso_two_chars ='jm' where iso ='jam';
UPDATE `countries` set iso_two_chars ='jp' where iso ='jpn';
UPDATE `countries` set iso_two_chars ='je' where iso ='jey';
UPDATE `countries` set iso_two_chars ='jo' where iso ='jor';
UPDATE `countries` set iso_two_chars ='kz' where iso ='kaz';
UPDATE `countries` set iso_two_chars ='ke' where iso ='ken';
UPDATE `countries` set iso_two_chars ='ki' where iso ='kir';
UPDATE `countries` set iso_two_chars ='kp' where iso ='prk';
UPDATE `countries` set iso_two_chars ='kr' where iso ='kor';
UPDATE `countries` set iso_two_chars ='kw' where iso ='kwt';
UPDATE `countries` set iso_two_chars ='kg' where iso ='kgz';
UPDATE `countries` set iso_two_chars ='la' where iso ='lao';
UPDATE `countries` set iso_two_chars ='lv' where iso ='lva';
UPDATE `countries` set iso_two_chars ='lb' where iso ='lbn';
UPDATE `countries` set iso_two_chars ='ls' where iso ='lso';
UPDATE `countries` set iso_two_chars ='lr' where iso ='lbr';
UPDATE `countries` set iso_two_chars ='ly' where iso ='lby';
UPDATE `countries` set iso_two_chars ='li' where iso ='lie';
UPDATE `countries` set iso_two_chars ='lt' where iso ='ltu';
UPDATE `countries` set iso_two_chars ='lu' where iso ='lux';
UPDATE `countries` set iso_two_chars ='mo' where iso ='mac';
UPDATE `countries` set iso_two_chars ='mk' where iso ='mkd';
UPDATE `countries` set iso_two_chars ='mg' where iso ='mdg';
UPDATE `countries` set iso_two_chars ='mw' where iso ='mwi';
UPDATE `countries` set iso_two_chars ='my' where iso ='mys';
UPDATE `countries` set iso_two_chars ='mv' where iso ='mdv';
UPDATE `countries` set iso_two_chars ='ml' where iso ='mli';
UPDATE `countries` set iso_two_chars ='mt' where iso ='mlt';
UPDATE `countries` set iso_two_chars ='mh' where iso ='mhl';
UPDATE `countries` set iso_two_chars ='mq' where iso ='mtq';
UPDATE `countries` set iso_two_chars ='mr' where iso ='mrt';
UPDATE `countries` set iso_two_chars ='mu' where iso ='mus';
UPDATE `countries` set iso_two_chars ='yt' where iso ='myt';
UPDATE `countries` set iso_two_chars ='mx' where iso ='mex';
UPDATE `countries` set iso_two_chars ='fm' where iso ='fsm';
UPDATE `countries` set iso_two_chars ='md' where iso ='mda';
UPDATE `countries` set iso_two_chars ='mc' where iso ='mco';
UPDATE `countries` set iso_two_chars ='mn' where iso ='mng';
UPDATE `countries` set iso_two_chars ='me' where iso ='mne';
UPDATE `countries` set iso_two_chars ='ms' where iso ='msr';
UPDATE `countries` set iso_two_chars ='ma' where iso ='mar';
UPDATE `countries` set iso_two_chars ='mz' where iso ='moz';
UPDATE `countries` set iso_two_chars ='mm' where iso ='mmr';
UPDATE `countries` set iso_two_chars ='na' where iso ='nam';
UPDATE `countries` set iso_two_chars ='nr' where iso ='nru';
UPDATE `countries` set iso_two_chars ='np' where iso ='npl';
UPDATE `countries` set iso_two_chars ='nl' where iso ='nld';
UPDATE `countries` set iso_two_chars ='nc' where iso ='ncl';
UPDATE `countries` set iso_two_chars ='nz' where iso ='nzl';
UPDATE `countries` set iso_two_chars ='ni' where iso ='nic';
UPDATE `countries` set iso_two_chars ='ne' where iso ='ner';
UPDATE `countries` set iso_two_chars ='ng' where iso ='nga';
UPDATE `countries` set iso_two_chars ='nu' where iso ='niu';
UPDATE `countries` set iso_two_chars ='nf' where iso ='nfk';
UPDATE `countries` set iso_two_chars ='mp' where iso ='mnp';
UPDATE `countries` set iso_two_chars ='no' where iso ='nor';
UPDATE `countries` set iso_two_chars ='om' where iso ='omn';
UPDATE `countries` set iso_two_chars ='pk' where iso ='pak';
UPDATE `countries` set iso_two_chars ='pw' where iso ='plw';
UPDATE `countries` set iso_two_chars ='ps' where iso ='pse';
UPDATE `countries` set iso_two_chars ='pa' where iso ='pan';
UPDATE `countries` set iso_two_chars ='pg' where iso ='png';
UPDATE `countries` set iso_two_chars ='py' where iso ='pry';
UPDATE `countries` set iso_two_chars ='pe' where iso ='per';
UPDATE `countries` set iso_two_chars ='ph' where iso ='phl';
UPDATE `countries` set iso_two_chars ='pn' where iso ='pcn';
UPDATE `countries` set iso_two_chars ='pl' where iso ='pol';
UPDATE `countries` set iso_two_chars ='pt' where iso ='prt';
UPDATE `countries` set iso_two_chars ='pr' where iso ='pri';
UPDATE `countries` set iso_two_chars ='qa' where iso ='qat';
UPDATE `countries` set iso_two_chars ='re' where iso ='reu';
UPDATE `countries` set iso_two_chars ='ro' where iso ='rou';
UPDATE `countries` set iso_two_chars ='ru' where iso ='rus';
UPDATE `countries` set iso_two_chars ='rw' where iso ='rwa';
UPDATE `countries` set iso_two_chars ='bl' where iso ='blm';
UPDATE `countries` set iso_two_chars ='sh' where iso ='shn';
UPDATE `countries` set iso_two_chars ='kn' where iso ='kna';
UPDATE `countries` set iso_two_chars ='lc' where iso ='lca';
UPDATE `countries` set iso_two_chars ='mf' where iso ='maf';
UPDATE `countries` set iso_two_chars ='pm' where iso ='spm';
UPDATE `countries` set iso_two_chars ='vc' where iso ='vct';
UPDATE `countries` set iso_two_chars ='ws' where iso ='wsm';
UPDATE `countries` set iso_two_chars ='sm' where iso ='smr';
UPDATE `countries` set iso_two_chars ='st' where iso ='stp';
UPDATE `countries` set iso_two_chars ='sa' where iso ='sau';
UPDATE `countries` set iso_two_chars ='sn' where iso ='sen';
UPDATE `countries` set iso_two_chars ='rs' where iso ='srb';
UPDATE `countries` set iso_two_chars ='sc' where iso ='syc';
UPDATE `countries` set iso_two_chars ='sl' where iso ='sle';
UPDATE `countries` set iso_two_chars ='sg' where iso ='sgp';
UPDATE `countries` set iso_two_chars ='sx' where iso ='sxm';
UPDATE `countries` set iso_two_chars ='sk' where iso ='svk';
UPDATE `countries` set iso_two_chars ='si' where iso ='svn';
UPDATE `countries` set iso_two_chars ='sb' where iso ='slb';
UPDATE `countries` set iso_two_chars ='so' where iso ='som';
UPDATE `countries` set iso_two_chars ='za' where iso ='zaf';
UPDATE `countries` set iso_two_chars ='gs' where iso ='sgs';
UPDATE `countries` set iso_two_chars ='ss' where iso ='ssd';
UPDATE `countries` set iso_two_chars ='es' where iso ='esp';
UPDATE `countries` set iso_two_chars ='lk' where iso ='lka';
UPDATE `countries` set iso_two_chars ='sd' where iso ='sdn';
UPDATE `countries` set iso_two_chars ='sr' where iso ='sur';
UPDATE `countries` set iso_two_chars ='sj' where iso ='sjm';
UPDATE `countries` set iso_two_chars ='sz' where iso ='swz';
UPDATE `countries` set iso_two_chars ='se' where iso ='swe';
UPDATE `countries` set iso_two_chars ='ch' where iso ='che';
UPDATE `countries` set iso_two_chars ='sy' where iso ='syr';
UPDATE `countries` set iso_two_chars ='tw' where iso ='twn';
UPDATE `countries` set iso_two_chars ='tj' where iso ='tjk';
UPDATE `countries` set iso_two_chars ='tz' where iso ='tza';
UPDATE `countries` set iso_two_chars ='th' where iso ='tha';
UPDATE `countries` set iso_two_chars ='tl' where iso ='tls';
UPDATE `countries` set iso_two_chars ='tg' where iso ='tgo';
UPDATE `countries` set iso_two_chars ='tk' where iso ='tkl';
UPDATE `countries` set iso_two_chars ='to' where iso ='ton';
UPDATE `countries` set iso_two_chars ='tt' where iso ='tto';
UPDATE `countries` set iso_two_chars ='tn' where iso ='tun';
UPDATE `countries` set iso_two_chars ='tr' where iso ='tur';
UPDATE `countries` set iso_two_chars ='tm' where iso ='tkm';
UPDATE `countries` set iso_two_chars ='tc' where iso ='tca';
UPDATE `countries` set iso_two_chars ='tv' where iso ='tuv';
UPDATE `countries` set iso_two_chars ='ug' where iso ='uga';
UPDATE `countries` set iso_two_chars ='ua' where iso ='ukr';
UPDATE `countries` set iso_two_chars ='ae' where iso ='are';
UPDATE `countries` set iso_two_chars ='gb' where iso ='gbr';
UPDATE `countries` set iso_two_chars ='us' where iso ='usa';
UPDATE `countries` set iso_two_chars ='um' where iso ='umi';
UPDATE `countries` set iso_two_chars ='uy' where iso ='ury';
UPDATE `countries` set iso_two_chars ='uz' where iso ='uzb';
UPDATE `countries` set iso_two_chars ='vu' where iso ='vut';
UPDATE `countries` set iso_two_chars ='ve' where iso ='ven';
UPDATE `countries` set iso_two_chars ='vn' where iso ='vnm';
UPDATE `countries` set iso_two_chars ='vg' where iso ='vgb';
UPDATE `countries` set iso_two_chars ='vi' where iso ='vir';
UPDATE `countries` set iso_two_chars ='wf' where iso ='wlf';
UPDATE `countries` set iso_two_chars ='eh' where iso ='esh';
UPDATE `countries` set iso_two_chars ='ye' where iso ='yem';
UPDATE `countries` set iso_two_chars ='zm' where iso ='zmb';
UPDATE `countries` set iso_two_chars ='zw' where iso ='zwe';

ALTER TABLE `site` MODIFY COLUMN `player` ENUM('html5', 'flashV2', 'flashV3','waveformPlayer','flash','quicktime','universal','qtSimple','flowPlayer','flashMp3Player','xspfPlayerSlim','originalSingle','jwPlayer','resizableMp3Player') NOT NULL DEFAULT 'html5full' COMMENT 'The embedded media player to use for audition playback.';
ALTER TABLE `users` MODIFY COLUMN `player` ENUM('html5', 'flashV2', 'flashV3', 'waveformPlayer','flash','quicktime','universal','qtSimple','flowPlayer','flashMp3Player','xspfPlayerSlim','originalSingle','jwPlayer','resizableMp3Player') NOT NULL DEFAULT 'html5full' COMMENT 'The embedded media player to use for audition playback.';

UPDATE settings set s_project_width = 265 where s_project_width IS NOT NULL AND s_project_width < 265;

ALTER TABLE `static_search_options` add `sequence` float null;
ALTER TABLE `static_search_options` add `tab_id` int(11);

CREATE TABLE `static_search_tabs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date_created` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `name` varchar(50) NOT NULL,
  `sequence` float DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

CREATE TABLE `selective_search_groups` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date_created` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `name` varchar(50) NOT NULL,
  `sequence` float DEFAULT NULL,
  `group_type` enum('or','and') DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;

CREATE TABLE `selective_search_options` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `search_criteria` varchar(250) DEFAULT NULL,
  `description` varchar(250) NOT NULL,
  `sequence` float DEFAULT NULL,
  `group_id` int(11) DEFAULT NULL,
  `batch_id` varchar(25) DEFAULT NULL,
  `search_criteria_exclude` varchar(250) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=5532 DEFAULT CHARSET=latin1;

/* *************** prior updates are for MUCH older versions ******************/
CREATE TABLE `widgets_roles` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date_created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `widgets_id` int(11) NOT NULL,
  `role_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=195 DEFAULT CHARSET=latin1;

CREATE TABLE `widgets` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `key_code` varchar(50) NOT NULL,
  `json` text,
  `active` int(10) unsigned DEFAULT '1',
  `title` varchar(50) DEFAULT NULL,
  `widgets_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `key_code` (`key_code`)
) ENGINE=MyISAM AUTO_INCREMENT=389 DEFAULT CHARSET=latin1;

ALTER TABLE widgets ADD `title` varchar(50) null;
ALTER TABLE widgets ADD `widgets_id` int(11) DEFAULT NULL;


CREATE TABLE `selective_search_groups` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date_created` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `name` varchar(50) NOT NULL,
  `sequence` float DEFAULT NULL,
  `group_type` enum('or','and') DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

CREATE TABLE `selective_search_options` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `search_criteria` varchar(250) DEFAULT NULL,
  `description` varchar(250) NOT NULL,
  `sequence` float DEFAULT NULL,
  `group_id` int(11) DEFAULT NULL,
  `batch_id` varchar(25) DEFAULT NULL,
  `search_criteria_exclude` varchar(250) DEFAULT NULL,
  `parent_title` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

CREATE TABLE `static_search_options` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `search_criteria` varchar(1000) DEFAULT NULL,
  `description` varchar(1000) NOT NULL,
  `category` varchar(25) DEFAULT NULL,
  `sequence` int(11) DEFAULT NULL,
  `tab_id` int(11) DEFAULT NULL,
  `widgets_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `category` (`category`)
) ENGINE=MyISAM AUTO_INCREMENT=3752 DEFAULT CHARSET=latin1;

CREATE TABLE `static_search_tabs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date_created` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `name` varchar(50) NOT NULL,
  `sequence` float DEFAULT NULL,
  `widgets_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;

ALTER TABLE static_search_tabs ADD `widgets_id` int(11) DEFAULT NULL;


ALTER TABLE folders ADD `section` enum('playlists','cuesheets') DEFAULT 'playlists';
ALTER TABLE folders ADD `cuesheet_title` varchar(100) DEFAULT NULL;
ALTER TABLE folders ADD `cuesheet_company` varchar(100) DEFAULT NULL;
ALTER TABLE folders ADD `cuesheet_description` varchar(250) DEFAULT NULL;
ALTER TABLE folders ADD `cuesheet_network` varchar(100) DEFAULT NULL;
ALTER TABLE folders ADD `cuesheet_address1` varchar(100) DEFAULT NULL;
ALTER TABLE folders ADD `cuesheet_address2` varchar(100) DEFAULT NULL;
ALTER TABLE folders ADD `cuesheet_city` varchar(50) DEFAULT NULL;
ALTER TABLE folders ADD `cuesheet_region` varchar(50) DEFAULT NULL;
ALTER TABLE folders ADD `cuesheet_postal` varchar(25) DEFAULT NULL;
ALTER TABLE folders ADD `cuesheet_country_iso` varchar(3) DEFAULT NULL;
ALTER TABLE folders ADD `cuesheet_phone` varchar(25) DEFAULT NULL;

ALTER TABLE log ADD `ctrl_name` varchar(15) DEFAULT NULL;
ALTER TABLE log ADD `ctrl_related_id` int(4) DEFAULT NULL;

drop table `help`;
CREATE TABLE `help` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique help page identifier.',
  `date_created` datetime NOT NULL,
  `sequence` int(11) NOT NULL DEFAULT '0',
  `title` varchar(255) NOT NULL COMMENT 'Displayable topic title.',
  `content` text NOT NULL COMMENT 'Help topic content.',
  PRIMARY KEY (`id`),
  FULLTEXT KEY `search` (`title`,`content`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

ALTER TABLE onepages ADD `pitch_display` tinyint DEFAULT 0;
ALTER TABLE onepages ADD `is_public` tinyint(4) NOT NULL DEFAULT '0';
ALTER TABLE onepages ADD `pitch_type` varchar(25) DEFAULT NULL;
ALTER TABLE onepages ADD `pitch_performer_name` varchar(100) DEFAULT NULL;
ALTER TABLE onepages ADD `pitch_purpose` varchar(25) DEFAULT NULL;
ALTER TABLE onepages ADD `pitch_method` varchar(25) DEFAULT NULL;
ALTER TABLE onepages ADD `pitch_status` varchar(25) DEFAULT NULL;
ALTER TABLE onepages ADD `pitch_to` varchar(100) DEFAULT NULL;
ALTER TABLE onepages ADD `pitch_contact_role` varchar(50) DEFAULT NULL;
ALTER TABLE onepages ADD `pitch_notes` text DEFAULT NULL;
ALTER TABLE onepages ADD `register_with_external_app` tinyint(4) DEFAULT '0';
ALTER TABLE onepages ADD `password_required` tinyint(4) DEFAULT '0';


ALTER TABLE playlists ADD `broadcast` tinyint(4) DEFAULT '0';
ALTER TABLE playlists ADD `status` tinyint(1) DEFAULT NULL;
ALTER TABLE playlists ADD `status_id` int(4) DEFAULT NULL;
ALTER TABLE playlists ADD `rate_id` int(4) DEFAULT NULL;
ALTER TABLE playlists ADD `clearance_id` int(4) DEFAULT NULL;
ALTER TABLE playlists ADD `market_id` int(4) DEFAULT NULL;
ALTER TABLE playlists ADD `broadcast` tinyint(4) DEFAULT NULL;
ALTER TABLE playlists ADD `creator_id` varchar(25) DEFAULT NULL;
ALTER TABLE playlists ADD `production_company` varchar(100) DEFAULT NULL;
ALTER TABLE playlists ADD `category` varchar(25) DEFAULT NULL;
ALTER TABLE playlists ADD `production_year` varchar(4) DEFAULT NULL;
ALTER TABLE playlists ADD `animation_indicator` tinyint(4) DEFAULT '0';
ALTER TABLE playlists ADD `master_cuesheet_indicator` tinyint(4) DEFAULT '0';
ALTER TABLE playlists ADD `master_cuesheet_indicator` tinyint(4) DEFAULT '0';
ALTER TABLE playlists ADD `public` tinyint(4) NOT NULL DEFAULT '0';

ALTER TABLE `queries` ADD query_trim varchar(500) DEFAULT NULL;
ALTER TABLE `queries` ADD databases_trim varchar(100) DEFAULT NULL;
update `queries` set `query_trim` = `query`;
update `queries` set `databases_trim` = `databases`;

ALTER TABLE quick_search_options ADD `widgets_id` int(4) DEFAULT NULL;

CREATE TABLE `search_topics_options` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `search_criteria` varchar(1000) DEFAULT NULL,
  `description` varchar(1000) NOT NULL,
  `playlist_id` int(11) DEFAULT NULL,
  `widgets_id` int(11) DEFAULT NULL,
  `sequence` int(11) DEFAULT NULL,
  `parent_title` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=745 DEFAULT CHARSET=latin1;

ALTER TABLE selective_search_options ADD `parent_title` varchar(100) DEFAULT NULL;

ALTER TABLE site ADD `cue_col_details` varchar(500) DEFAULT NULL;

ALTER TABLE static_search_options ADD `widgets_id` int(11) DEFAULT NULL;
ALTER TABLE static_search_options ADD `tab_id` int(11) DEFAULT NULL;

ALTER TABLE static_search_tabs ADD `widgets_id` int(11) DEFAULT NULL;

ALTER TABLE tracks ADD `CueInTime` varchar(30) DEFAULT NULL;
ALTER TABLE tracks ADD `CueOutTime` varchar(30) DEFAULT NULL;
ALTER TABLE tracks ADD `CueTime` varchar(30) DEFAULT NULL;
ALTER TABLE tracks ADD `CuePublisher` text;
ALTER TABLE tracks ADD `CueComposer` text;
ALTER TABLE tracks ADD `CueUsage` varchar(250) DEFAULT NULL;
ALTER TABLE tracks ADD `CueUpLoaded` int(5) DEFAULT NULL;
ALTER TABLE tracks ADD `track_comments` text;

ALTER TABLE users ADD `country_text` varchar(50) DEFAULT NULL;

ALTER TABLE widgets ADD `title` varchar(50) DEFAULT NULL;
ALTER TABLE widgets ADD `widgets_id` int(11) DEFAULT NULL;

CREATE TABLE `widgets_roles` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date_created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `widgets_id` int(11) NOT NULL,
  `role_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=195 DEFAULT CHARSET=latin1;

ALTER TABLE `history` ADD `public_session_id` varchar(40) DEFAULT NULL;

ALTER TABLE settings ADD `s_topics_show` enum('hide','show') DEFAULT 'hide';
ALTER TABLE settings ADD `u_topics_show` enum('hide','show') DEFAULT 'hide';

CREATE TABLE `html_site_customizations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`date_created` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`login_head` text COMMENT 'Custom HTML to insert at end of <head></head>.',
`login_body1` text COMMENT 'Custom HTML to insert at start of <body></body>.',
`login_body2` text COMMENT 'Custom HTML to insert at end of <body></body>.',
`main_head` text COMMENT 'Custom HTML to insert at end of <head></head>.',
`main_body1` text COMMENT 'Custom HTML to insert at start of <body></body>.',
`main_body2` text COMMENT 'Custom HTML to insert at end of <body></body>.',
`admin_head` text COMMENT 'Custom HTML to insert at end of <head></head>.',
`admin_body1` text COMMENT 'Custom HTML to insert at start of <body></body>.',
`admin_body2` text COMMENT 'Custom HTML to insert at end of <body></body>.',
`widgets_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `widgets_id` (`widgets_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

CREATE TABLE `comm_cart_items` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date_created` timestamp NULL DEFAULT NULL,
  `cart_id` int(11) NOT NULL,
  `quantity` int(11) DEFAULT NULL,
  `Duration` time DEFAULT NULL,
  `CDTitle` varchar(100) DEFAULT NULL,
  `Description` varchar(1000) DEFAULT NULL,
  `Composer` varchar(255) DEFAULT NULL,
  `FilePath` varchar(255) DEFAULT NULL,
  `FileType` varchar(4) DEFAULT NULL,
  `Picture` mediumblob,
  `Waveform` mediumblob,
  `track_id` int(11) DEFAULT NULL,
  `TrackTitle` varchar(255) DEFAULT NULL,
  `Volume` varchar(100) DEFAULT NULL,
  `Library` varchar(150) DEFAULT NULL,
  `Manufacturer` varchar(150) DEFAULT NULL,
  `Publisher` varchar(255) DEFAULT NULL,
  `Source` varchar(62) DEFAULT NULL,
  `Category` varchar(62) DEFAULT NULL,
  `Version` varchar(31) DEFAULT NULL,
  `_WaveformLink` int(11) DEFAULT NULL,
  `_PictureLink` int(11) DEFAULT NULL,
  `db_id` int(11) DEFAULT NULL,
  `Picture_Hash` varchar(50) DEFAULT NULL,
  `Waveform_Hash` varchar(50) DEFAULT NULL,
  `Track` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `cart_id` (`cart_id`),
  KEY `track_id` (`track_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `comm_carts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `users_id` int(11) NOT NULL,
  `date_created` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `users_id` (`users_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `comm_clearances` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `parent_id` int(11) DEFAULT NULL,
  `position` float DEFAULT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `children_category` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `definition` text COLLATE utf8_unicode_ci,
  `parent_clearance` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `index_clearances_on_parent_id_and_position` (`parent_id`,`position`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `comm_markets` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `position` float DEFAULT NULL,
  `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `definition` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `region_code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `country_code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `index_markets_on_position` (`position`),
  KEY `index_markets_on_country_code_and_region_code` (`country_code`,`region_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `comm_order_items` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date_created` timestamp NULL DEFAULT NULL,
  `order_id` int(11) NOT NULL,
  `quantity` int(11) DEFAULT NULL,
  `Duration` time DEFAULT NULL,
  `CDTitle` varchar(100) DEFAULT NULL,
  `Description` varchar(1000) DEFAULT NULL,
  `Composer` varchar(255) DEFAULT NULL,
  `FilePath` varchar(255) DEFAULT NULL,
  `FileType` varchar(4) DEFAULT NULL,
  `Picture` mediumblob,
  `Waveform` mediumblob,
  `track_id` int(11) DEFAULT NULL,
  `TrackTitle` varchar(255) DEFAULT NULL,
  `Volume` varchar(100) DEFAULT NULL,
  `Library` varchar(150) DEFAULT NULL,
  `Manufacturer` varchar(150) DEFAULT NULL,
  `Publisher` varchar(255) DEFAULT NULL,
  `Source` varchar(62) DEFAULT NULL,
  `Category` varchar(62) DEFAULT NULL,
  `Version` varchar(31) DEFAULT NULL,
  `_WaveformLink` int(11) DEFAULT NULL,
  `_PictureLink` int(11) DEFAULT NULL,
  `db_id` int(11) DEFAULT NULL,
  `Picture_Hash` varchar(50) DEFAULT NULL,
  `Waveform_Hash` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `cart_id` (`order_id`),
  KEY `track_id` (`track_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `comm_orders` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date_created` datetime DEFAULT NULL,
  `users_id` int(11) DEFAULT NULL,
  `cart_id` int(11) DEFAULT NULL,
  `sales_person_users_id` int(11) DEFAULT NULL,
  `sales_person_name` varchar(100) DEFAULT NULL,
  `clearance` varchar(50) DEFAULT NULL,
  `territory` varchar(50) DEFAULT NULL,
  `total` decimal(10,2) DEFAULT NULL,
  `tax` decimal(10,2) DEFAULT NULL,
  `gateway_response_raw` text,
  `status` varchar(25) NOT NULL DEFAULT 'pending',
  `approved` tinyint(4) NOT NULL DEFAULT '0',
  `payment_method` varchar(25) NOT NULL,
  `customer_notes` tinytext,
  `sales_notes` text,
  `rate_header_1` varchar(200) DEFAULT NULL,
  `rate_header_2` varchar(200) DEFAULT NULL,
  `rate_header_3` varchar(200) DEFAULT NULL,
  `rate_header_4` varchar(200) DEFAULT NULL,
  `rate_label_1` varchar(200) DEFAULT NULL,
  `rate_value_1` varchar(200) DEFAULT NULL,
  `rate_label_2` varchar(200) DEFAULT NULL,
  `rate_value_2` varchar(200) DEFAULT NULL,
  `rate_label_3` varchar(200) DEFAULT NULL,
  `rate_value_3` varchar(200) DEFAULT NULL,
  `rate_label_4` varchar(200) DEFAULT NULL,
  `rate_value_4` varchar(200) DEFAULT NULL,
  `order_tracking_info` varchar(50) DEFAULT NULL,
  `first_name` varchar(50) DEFAULT NULL,
  `last_name` varchar(50) DEFAULT NULL,
  `address1` varchar(255) DEFAULT NULL,
  `address2` varchar(255) DEFAULT NULL,
  `city` varchar(50) DEFAULT NULL,
  `region` varchar(50) DEFAULT NULL,
  `postal_code` varchar(30) DEFAULT NULL,
  `phone` varchar(32) DEFAULT NULL,
  `phone_fax` varchar(32) DEFAULT NULL,
  `notes` text,
  `series_film_title` varchar(100) DEFAULT NULL,
  `episode_spot_title` varchar(100) DEFAULT NULL,
  `station` varchar(100) DEFAULT NULL,
  `producer` varchar(100) DEFAULT NULL,
  `episode` varchar(100) DEFAULT NULL,
  `air_date` varchar(100) DEFAULT NULL,
  `studio` varchar(100) DEFAULT NULL,
  `credit_name_on_card` varchar(100) DEFAULT NULL,
  `credit_type` varchar(4) DEFAULT NULL,
  `credit_exp_month` int(11) DEFAULT NULL,
  `credit_exp_year` int(11) DEFAULT NULL,
  `credit_card_last_four` int(11) DEFAULT NULL,
  `company` varchar(100) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `job_title` varchar(50) DEFAULT NULL,
  `phone_cell` varchar(32) DEFAULT NULL,
  `country_iso` varchar(3) DEFAULT NULL,
  `rate_matrix_key_id` varchar(25) DEFAULT NULL,
  `rate_label_custom_1` varchar(50) DEFAULT NULL,
  `rate_label_custom_2` varchar(50) DEFAULT NULL,
  `rate_label_custom_3` varchar(50) DEFAULT NULL,
  `rate_label_custom_4` varchar(50) DEFAULT NULL,
  `rate_value_custom_1` float DEFAULT NULL,
  `rate_value_custom_2` float DEFAULT NULL,
  `rate_value_custom_3` float DEFAULT NULL,
  `rate_value_custom_4` float DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `comm_payment_methods` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;



CREATE TABLE `comm_rate_card_custom_clearances` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `position` float DEFAULT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `definition` text COLLATE utf8_unicode_ci,
  `factor` float DEFAULT NULL,
  `value` decimal(10,2) NOT NULL DEFAULT '0.00',
  PRIMARY KEY (`id`),
  KEY `index_clearances_on_parent_id_and_position` (`position`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `comm_rate_card_custom_durations` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `position` float DEFAULT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `duration` float DEFAULT NULL,
  `duration_unit` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
  `definition` text COLLATE utf8_unicode_ci,
  `factor` float DEFAULT NULL,
  `value` decimal(10,2) NOT NULL DEFAULT '0.00',
  PRIMARY KEY (`id`),
  KEY `index_clearances_on_parent_id_and_position` (`position`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `comm_rate_card_custom_prod_types` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `position` float DEFAULT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `definition` text COLLATE utf8_unicode_ci,
  `factor` float DEFAULT NULL,
  `value` decimal(10,2) NOT NULL DEFAULT '0.00',
  PRIMARY KEY (`id`),
  KEY `index_clearances_on_parent_id_and_position` (`position`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `comm_rate_card_custom_territories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `position` float DEFAULT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `definition` text COLLATE utf8_unicode_ci,
  `factor` float DEFAULT NULL,
  `value` decimal(10,2) NOT NULL DEFAULT '0.00',
  PRIMARY KEY (`id`),
  KEY `index_clearances_on_parent_id_and_position` (`position`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `comm_rate_card_presets` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sales_person_users_id` int(11) NOT NULL,
  `users_id` int(11) NOT NULL,
  `rate_info` text NOT NULL,
  `rate_matrix_key_id` varchar(20) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `users_id` (`users_id`),
  KEY `rate_matrix_key_id` (`rate_matrix_key_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `comm_rates` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `clearance_id` int(11) DEFAULT NULL,
  `market_id` int(11) DEFAULT NULL,
  `price` int(11) DEFAULT NULL,
  `license_type` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `index_rates_on_clearance_id_and_market_id` (`clearance_id`,`market_id`),
  KEY `index_rates_on_market_id` (`market_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `site` MODIFY COLUMN `player` enum('html5','html5fullAltOne','flashV2','flashV3','waveformPlayer','flash','quicktime','universal','qtSimple','flowPlayer','flashMp3Player','xspfPlayerSlim','originalSingle','jwPlayer','resizableMp3Player','html5full');

ALTER TABLE `users` MODIFY COLUMN `player` enum('html5','html5fullAltOne','flashV2','flashV3','waveformPlayer','flash','quicktime','universal','qtSimple','flowPlayer','flashMp3Player','xspfPlayerSlim','originalSingle','jwPlayer','resizableMp3Player','html5full');

ALTER TABLE `onepages` MODIFY COLUMN `password` varchar(50) null;

ALTER TABLE `playlists` ADD COLUMN `originator_first_name` varchar(50) null;
ALTER TABLE `playlists` ADD COLUMN `originator_last_name` varchar(50) null;
ALTER TABLE `playlists` ADD COLUMN `originator_email` varchar(255) null;
ALTER TABLE `playlists` ADD COLUMN `originator_user_id` int(11) null;



INSERT INTO `columns` (`id`,`display`,`active`,`browse`,`context`,`link`,`split_text`,`meta_browse_fields`)
VALUES
	('CueInTime', 'CueInTime', 1, 0, 'cuesheet', 'field', '', NULL),
	('CueOutTime', 'CueOutTime', 1, 0, 'cuesheet', 'field', '', NULL);


ALTER TABLE `settings` ADD COLUMN `p_times` varchar(25) null;
ALTER TABLE `settings` ADD COLUMN `u_continuous_show` enum('on', 'off') default 'on';
ALTER TABLE `settings` ADD COLUMN `s_continuous_show` enum('on', 'off') default 'on';
ALTER TABLE `settings` ADD COLUMN `s_topics_show` enum('on', 'off') default 'off';
ALTER TABLE `settings` ADD COLUMN `s_topics_show` enum('on', 'off') default 'off';
ALTER TABLE `settings` ADD COLUMN `u_selective_show` enum('on', 'off') default 'off';
ALTER TABLE `settings` ADD COLUMN `s_selective_show` enum('on', 'off') default 'off';
ALTER TABLE `settings` ADD COLUMN `u_panel_selected` int default 0;
ALTER TABLE `settings` ADD COLUMN `s_panel_selected` int default 0;
ALTER TABLE `settings` ADD COLUMN `u_static_options` text null;
ALTER TABLE `settings` ADD COLUMN `s_static_options` text null;
ALTER TABLE `settings` ADD `s_topics_show_details` text DEFAULT NULL;
ALTER TABLE `settings` ADD `u_topics_show_details` text DEFAULT NULL;
ALTER TABLE `settings` ADD `s_set_topics_sections` text DEFAULT NULL;
ALTER TABLE `settings` ADD `u_set_topics_sections` text DEFAULT NULL;


CREATE TABLE `search_topics_options_headers` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(100) NOT NULL DEFAULT '',
  `sequence` int(11) NOT NULL DEFAULT '0',
  `widgets_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1;

ALTER TABLE `search_topics_options` ADD COLUMN `header_id` int(11) DEFAULT NULL;
ALTER TABLE users ADD `is_public` tinyint(4) NOT NULL DEFAULT '0';

CREATE TABLE `media` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `title` varchar(255) NOT NULL DEFAULT '',
  `description` text,
  `file_size` decimal(10,2) NOT NULL,
  `mime_type` varchar(25) NOT NULL DEFAULT '',
  `filename` varchar(255) NOT NULL DEFAULT '',
  `users_id` int(11) NOT NULL,
  `extension` varchar(25) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

ALTER TABLE `widgets` MODIFY COLUMN `key_code` varchar(50) not null;

ALTER TABLE `playlists` MODIFY COLUMN `job_no` varchar(100) null;
ALTER TABLE `playlists` MODIFY COLUMN `version_type` varchar(100) null;
ALTER TABLE `playlists` MODIFY COLUMN `program_type` varchar(100) null;
ALTER TABLE `playlists` MODIFY COLUMN `production_no` varchar(100) null;
ALTER TABLE `playlists` MODIFY COLUMN `title` varchar(200) null;

ALTER TABLE `countries` ADD `regional_site_title` varchar(255) null;
ALTER TABLE `countries` ADD `regional_site_description` text null;
ALTER TABLE `countries` ADD `regional_site_keywords` text null;
ALTER TABLE `countries` ADD `regional_reg_emails` text null;
ALTER TABLE `countries` ADD `regional_help_url` text null;

ALTER TABLE `site` ADD `reg_emails` text null;

ALTER TABLE `quick_search_options` ADD `img` varchar(255) DEFAULT NULL;

ALTER TABLE `settings` ADD `p_admin_download_xml` tinyint null;

ALTER TABLE `groups` modify column `notes` text null;

ALTER TABLE `site` modify column `registration_alert` text null;

ALTER TABLE `site` ADD column `password_length` TINYINT null;

ALTER TABLE `site` ADD column `password_complexity` TINYINT default 0;

ALTER TABLE `log_downloads` MODIFY COLUMN `file_type` varchar(255) null;

CREATE TABLE `smdl` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `payload` longtext NOT NULL,
  `expiration` int(11) NOT NULL,
  `pkg_id` char(16) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;

ALTER TABLE `playlists` modify column `notes` text null;
ALTER TABLE `playlists` ADD `system_msg` text null;

CREATE TABLE `usercomment_comments` (
  `user_id` int(11) NOT NULL,
  `db_id` int(11) NOT NULL,
  `metadata_id` int(11) NOT NULL,
  `comment` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

ALTER TABLE `usercomment_comments` ADD UNIQUE KEY `my_unique_key` (`user_id`,`db_id`,`metadata_id`);

ALTER TABLE `onepages` ADD `attachments` text null;
ALTER TABLE `settings` ADD `thesaurus_status` tinyint(4);


CREATE TABLE `comm_payments` (
  `id` int(11) NOT NULL,
  `payment_user_id` int(11) NOT NULL,
  `payment_order_id` int(11) NOT NULL,
  `payment_token` varchar(255) NOT NULL,
  `payment_amount` varchar(255) NOT NULL,
  `payment_type` varchar(255) DEFAULT NULL,
  `payment_gateway` varchar(255) DEFAULT NULL,
  `payment_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `payment_transaction_id` varchar(255) DEFAULT NULL,
  `payment_payer_id` varchar(255) DEFAULT NULL,
  `payment_email` varchar(255) DEFAULT NULL,
  `payment_firstname` varchar(255) DEFAULT NULL,
  `payment_lastname` varchar(255) DEFAULT NULL,
  `payment_countrycode` varchar(255) DEFAULT NULL,
  `payment_fee` varchar(255) DEFAULT NULL,
  `payment_tax` varchar(255) DEFAULT NULL,
  `payment_responsereason` text,
  `payment_status` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

ALTER TABLE `comm_payments` ADD PRIMARY KEY (`id`);
ALTER TABLE `comm_payments` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

Alter table `comm_payments` ADD `payment_order_data` longtext;
Alter table `comm_payments` ADD `payment_currency` Varchar(255);



CREATE TABLE `comm_price` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `db` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `manufact` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `lib` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `album` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `rec_um_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `path` text COLLATE utf8_unicode_ci NOT NULL,
  `price` text COLLATE utf8_unicode_ci NOT NULL,
  `created` timestamp NULL DEFAULT NULL,
  `updated` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_index` (`db`,`rec_um_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


Alter table `comm_cart_items` ADD `_UMID` Varchar(255);


Alter table `comm_order_items` ADD `prod_type` Varchar(255);
Alter table `comm_order_items` ADD `clearance` Varchar(255);
Alter table `comm_order_items` ADD `territory` Varchar(255);
Alter table `comm_order_items` ADD `term` Varchar(255);
Alter table `comm_order_items` ADD `price` Varchar(255);
Alter table `comm_order_items` ADD `item_group` Varchar(255);
Alter table `comm_order_items` ADD `prod_type_text` Varchar(255);
Alter table `comm_order_items` ADD `clearance_text` Varchar(255);
Alter table `comm_order_items` ADD `territory_text` Varchar(255);
Alter table `comm_order_items` ADD `term_text` Varchar(255);



Alter table `comm_orders` ADD `license-first_name` Varchar(255);
Alter table `comm_orders` ADD `license-last_name` Varchar(255);
Alter table `comm_orders` ADD `license-company` Varchar(255);
Alter table `comm_orders` ADD `license-address1` Varchar(255);
Alter table `comm_orders` ADD `license-address2` Varchar(255);
Alter table `comm_orders` ADD `license-city` Varchar(255);
Alter table `comm_orders` ADD `license-region` Varchar(255);
Alter table `comm_orders` ADD `license-postal_code` Varchar(255);
Alter table `comm_orders` ADD `license-country_iso` Varchar(255);
Alter table `comm_orders` ADD `license-phone` Varchar(255);
Alter table `comm_orders` ADD `license-phone_cell` Varchar(255);
Alter table `comm_orders` ADD `license-phone_fax` Varchar(255);
Alter table `comm_orders` ADD `license-email` Varchar(255);
Alter table `comm_orders` ADD `license-job_title` Varchar(255);
Alter table `comm_orders` ADD `payment_id` Int(11);








