use [% cpm %];
# alter existing tables
ALTER TABLE [% table_prefix %]_albums
  DROP COLUMN pic_count,
  DROP COLUMN last_addition,
  DROP COLUMN stat_uptodate,
  ADD COLUMN alb_password VARCHAR( 32 ) AFTER keyword,
  ADD COLUMN alb_password_hint TEXT AFTER  alb_password
;
ALTER TABLE [% table_prefix %]_categories
  DROP COLUMN subcat_count,
  DROP COLUMN alb_count,
  DROP COLUMN pic_count, 
  DROP COLUMN stat_uptodate
;
ALTER TABLE [% table_prefix %]_pictures
  DROP COLUMN randpos, 
  ADD COLUMN galleryicon int(11) NOT NULL default '0' AFTER approved,
  ADD COLUMN lasthit_ip tinytext AFTER galleryicon, 
  ADD COLUMN position INT(11) NOT NULL default '0' AFTER lasthit_ip
;
ALTER TABLE [% table_prefix %]_users
  CHANGE COLUMN user_website user_profile1 varchar(255) NOT NULL default '',
  CHANGE COLUMN user_location user_profile2 varchar(255) NOT NULL default '',
  CHANGE COLUMN user_interests user_profile3 varchar(255) NOT NULL default '',
  CHANGE COLUMN user_occupation user_profile4 varchar(255) NOT NULL default '',
  ADD COLUMN user_profile5 varchar(255) NOT NULL default '' AFTER user_profile4,
  ADD COLUMN user_profile6 text NOT NULL default '' AFTER user_profile5
;
ALTER TABLE [% table_prefix %]_banned
  ADD COLUMN brute_force tinyint(5) NOT NULL default '0' AFTER expiry
;
ALTER TABLE [% table_prefix %]_filetypes
  ADD COLUMN player varchar(5) default NULL AFTER content
;
# create new tables
#
# Table structure for table `[% table_prefix %]_sessions`
#
CREATE TABLE IF NOT EXISTS [% table_prefix %]_sessions (
  session_id varchar(40) NOT NULL default '',
  user_id int(11) default '0',
  time int(11) default NULL,
  remember int(1) default '0',
  PRIMARY KEY (session_id)
) TYPE=MyISAM COMMENT='Used to store sessions';
#
# Table structure for table `[% table_prefix %]_plugins`
#
CREATE TABLE [% table_prefix %]_plugins (
  plugin_id int(10) unsigned NOT NULL auto_increment,
  name varchar(64) NOT NULL default '',
  path varchar(128) NOT NULL default '',
  priority int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (plugin_id),
  UNIQUE KEY name (name),
  UNIQUE KEY path (path)
) TYPE=MyISAM COMMENT='Stores the plugins';
#
# Table structure for table `[% table_prefix %]_favpics`
#
CREATE TABLE `[% table_prefix %]_favpics` (
`user_id` INT( 11 ) NOT NULL ,
`user_favpics` TEXT NOT NULL ,
PRIMARY KEY ( `user_id` )
) COMMENT = 'Stores the server side favourites';
#
# Table structure for table `[% table_prefix %]_dict`
#
CREATE TABLE [% table_prefix %]_dict (
  keyId bigint(20) NOT NULL auto_increment,
  keyword varchar(60) NOT NULL default '',
  PRIMARY KEY  (keyId)
) TYPE=MyISAM  COMMENT = 'Holds the keyword dictionary';
#
# Table structure for table `[% table_prefix %]_bridge`
#
CREATE TABLE [% table_prefix %]_bridge (
  name varchar(40) NOT NULL default '0',
  value varchar(255) NOT NULL default '',
  UNIQUE KEY name (name)
) TYPE=MyISAM;
#
# Table structure for table `[% table_prefix %]_vote_stats`
#
CREATE TABLE `[% table_prefix %]_vote_stats` (
  `sid` int(11) NOT NULL auto_increment,
  `pid` varchar(100) NOT NULL default '',
  `rating` smallint(6) NOT NULL default '0',
  `ip` varchar(20) NOT NULL default '',
  `sdate` bigint(20) NOT NULL default '0',
  `referer` text NOT NULL,
  `browser` varchar(255) NOT NULL default '',
  `os` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`sid`)
);
CREATE TABLE `[% table_prefix %]_hit_stats` (
  `sid` int(11) NOT NULL auto_increment,
  `pid` varchar(100) NOT NULL default '',
  `ip` varchar(20) NOT NULL default '',
  `search_phrase` varchar(255) NOT NULL default '',
  `sdate` bigint(20) NOT NULL default '0',
  `referer` text NOT NULL,
  `browser` varchar(255) NOT NULL default '',
  `os` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`sid`)
);
# update  data 
UPDATE [% table_prefix %]_config SET value = 'doc/txt/rtf/pdf/xls/pps/ppt/zip/gz/mdb' WHERE name = 'allowed_doc_types';
UPDATE [% table_prefix %]_config SET value='mp3/midi/mid/wma/wav/ogg' WHERE name = 'allowed_snd_types';
UPDATE [% table_prefix %]_config SET value='core' WHERE name = 'theme';
UPDATE [% table_prefix %]_config SET value='utf-8' WHERE name = 'charset';
UPDATE [% table_prefix %]_config SET value= 'cpg143' WHERE name = 'cookie_name';
UPDATE [% table_prefix %]_filetypes SET player = '' 
 WHERE extension = 'jpg'
  OR extension = 'jpeg' 
  OR extension = 'jpe' 
  OR extension = 'gif' 
  OR extension = 'png'
  OR extension = 'bmp'
  OR extension = 'jp2'
  OR extension = 'jpx'
  OR extension = 'jb2'
  OR extension = 'swc'
  OR extension = 'iff'
  OR extension = 'ogg'
  OR extension = 'psd'
  OR extension = 'tiff'
  OR extension = 'tif'
  OR extension = 'doc'
  OR extension = 'txt'
  OR extension = 'rtf'
  OR extension = 'pdf'
  OR extension = 'xls'
  OR extension = 'pps'
  OR extension = 'ppt'
  OR extension = 'zip'
  OR extension = 'rar'
  OR extension = 'gz'
  OR extension = 'mdb'
;
UPDATE [% table_prefix %]_filetypes SET player = 'WMP' 
 WHERE extension = 'asf'
  OR extension = 'asx'
  OR extension = 'mpg'
  OR extension = 'mpeg'
  OR extension = 'wmv'
  OR extension = 'avi'
  OR extension = 'mp3'
  OR extension = 'midi'
  OR extension = 'mid'
  OR extension = 'wma'
  OR extension = 'wav'
;
UPDATE [% table_prefix %]_filetypes SET player = 'QT' WHERE extension = 'mov';
UPDATE [% table_prefix %]_filetypes  SET player = 'SWF' WHERE extension ='swf';
UPDATE [% table_prefix %]_filetypes SET player = 'RMP'
  WHERE extension = 'ram'
  OR extension = 'ra'
 OR extension = 'rm'
;
# insert new data 
INSERT INTO [% table_prefix %]_config VALUES ('allow_unlogged_access', '1');
INSERT INTO [% table_prefix %]_config VALUES ('home_target', 'index.php');
INSERT INTO [% table_prefix %]_config VALUES ('custom_lnk_name', '');
INSERT INTO [% table_prefix %]_config VALUES ('custom_lnk_url', '');
INSERT INTO [% table_prefix %]_config VALUES ('auto_resize', '0');

INSERT INTO [% table_prefix %]_config VALUES ('vanity_block','1');
#
# added custom profile
#
INSERT INTO [% table_prefix %]_config VALUES ('user_profile1_name', 'Location');
INSERT INTO [% table_prefix %]_config VALUES ('user_profile2_name', 'Interests');
INSERT INTO [% table_prefix %]_config VALUES ('user_profile3_name', 'Website');
INSERT INTO [% table_prefix %]_config VALUES ('user_profile4_name', 'Occupation');
INSERT INTO [% table_prefix %]_config VALUES ('user_profile5_name', '');
INSERT INTO [% table_prefix %]_config VALUES ('user_profile6_name', 'Biography');
INSERT INTO [% table_prefix %]_config VALUES ('display_film_strip_filename', '0');
# INSERT INTO [% table_prefix %]_config VALUES ('display_admin_uploader','0');
INSERT INTO [% table_prefix %]_config VALUES ('display_filename','0');
INSERT INTO [% table_prefix %]_config VALUES ('log_mode', '0');
INSERT INTO [% table_prefix %]_config VALUES ('media_autostart', '1');
INSERT INTO [% table_prefix %]_config VALUES ('enable_encrypted_passwords','1');
INSERT INTO [% table_prefix %]_config VALUES ('time_offset', '0');
INSERT INTO [% table_prefix %]_config VALUES ('ban_private_ip', '0');
INSERT INTO [% table_prefix %]_config VALUES ('smtp_host', '');
INSERT INTO [% table_prefix %]_config VALUES ('smtp_username', '');
INSERT INTO [% table_prefix %]_config VALUES ('smtp_password', '');
INSERT INTO [% table_prefix %]_config VALUES ('enable_plugins', '1');
INSERT INTO [% table_prefix %]_config VALUES ('enable_help', '2');
INSERT INTO [% table_prefix %]_config VALUES ('categories_alpha_sort', '0');
INSERT INTO [% table_prefix %]_config VALUES ('login_threshold', '5');
INSERT INTO [% table_prefix %]_config VALUES ('login_expiry', '10');
INSERT INTO [% table_prefix %]_config VALUES ('allow_email_change', '0');
INSERT INTO [% table_prefix %]_config VALUES ('clickable_keyword_search', '1');
INSERT INTO [% table_prefix %]_config VALUES ('users_can_edit_pics', '0');
INSERT INTO [% table_prefix %]_config VALUES ('show_which_exif', '|0|0|0|0|0|0|0|0|1|0|1|1|0|0|0|0|0|0|0|0|0|0
|0|1|0|0|0|1|0|0|0|1|1|0|0|0|0|1|0|0|0|1|0|0|1|1|0|0|0|0|0|1|0|1|1');
INSERT INTO [% table_prefix %]_config VALUES ('alb_desc_thumb', '1');
INSERT INTO [% table_prefix %]_config VALUES ('link_pic_count', '0');
INSERT INTO [% table_prefix %]_config VALUES ('bridge_enable', '0');
#
# Data for table `[% table_prefix %]_bridge`
# Used for bridging by user interface
#
INSERT INTO [% table_prefix %]_bridge VALUES ('short_name', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('license_number', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('db_database_name', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('db_hostname', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('db_username', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('db_password', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('full_forum_url', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('relative_path_of_forum_from_webroot', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('relative_path_to_config_file', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('logout_flag', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('use_post_based_groups', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('cookie_prefix', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('table_prefix', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('user_table', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('session_table', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('group_table', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('group_relation_table', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('group_mapping_table', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('use_standard_groups', '1');
INSERT INTO [% table_prefix %]_bridge VALUES ('validating_group', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('guest_group', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('member_group', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('admin_group', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('banned_group', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('global_moderators_group', '');
INSERT INTO [% table_prefix %]_bridge VALUES ('recovery_logon_failures', '0');
INSERT INTO [% table_prefix %]_bridge VALUES ('recovery_logon_timestamp', '');
INSERT INTO [% table_prefix %]_config VALUES ('language_fallback', '1');
INSERT INTO [% table_prefix %]_config VALUES ('vote_details', '0');
INSERT INTO [% table_prefix %]_config VALUES ('hit_details', '0');
INSERT INTO [% table_prefix %]_config VALUES ('browse_batch_add', '1');
INSERT INTO [% table_prefix %]_config VALUES ('custom_header_path', '');
INSERT INTO [% table_prefix %]_config VALUES ('custom_footer_path', '');
INSERT INTO [% table_prefix %]_config VALUES ('comments_sort_descending', '0');
INSERT INTO [% table_prefix %]_config VALUES ('report_post', '0');
INSERT INTO [% table_prefix %]_config VALUES ('comments_anon_pfx', 'Guest_');
INSERT INTO [% table_prefix %]_config VALUES ('admin_activation', '0');
