#+###################################-+
#|                  osCSS Open Source E-commerce                         |
#+###################################-+
#| Copyright (c) 2005-2010 The osCSS developers                          |
#|                                                                       |
#| http://www.oscss.org                                                  |
#| http://www.oscim.net                                                  |
#| Portions Copyright (c) 2003 osCommerce                                |
#+###################################-+
#| This source file is subject to version 2.0 of the GPL license,        |
#| available at the following url:                                       |
#| http://www.oscss.org/license/2_0.txt.                                 |
#+###################################-+

# NOTE: * Please make any modifications to this file by hand!
#       * DO NOT use a mysqldump created file for new changes!
#       * Please take note of the table structure, and use this
#         structure as a standard for future modifications!
#       * Any tables you add here should be added in admin/backup.php
#         and in catalog/install/includes/functions/database.php
#       * Comments should be like these, full line comments.
#         (don't use inline comments)





if not exists (select * from osc_configuration where configuration_key = 'CFG_CLASS_VIRTUAL_TYPE_1' )
insert into osc_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function , set_function,configuration_type) values ('CFG_CLASS_VIRTUAL_TYPE_1_S', 'CFG_CLASS_VIRTUAL_TYPE_1', '', 'CFG_CLASS_VIRTUAL_TYPE_L', '0', '0', NOW(), NOW(),NULL, 'tep_cfg_text_auto(', 1);

if not exists (select * from osc_configuration where configuration_key = 'CFG_CLASS_VIRTUAL_TYPE_2' )
insert into osc_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function , set_function,configuration_type) values ('CFG_CLASS_VIRTUAL_TYPE_2_S', 'CFG_CLASS_VIRTUAL_TYPE_2', '', 'CFG_CLASS_VIRTUAL_TYPE_L', '0', '0', NOW(), NOW(),NULL, 'tep_cfg_text_auto(', 1);

if not exists (select * from osc_configuration where configuration_key = 'CFG_CLASS_VIRTUAL_TYPE_3' )
insert into osc_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function , set_function,configuration_type) values ('CFG_CLASS_VIRTUAL_TYPE_3_S', 'CFG_CLASS_VIRTUAL_TYPE_3', '', 'CFG_CLASS_VIRTUAL_TYPE_L', '0', '0', NOW(), NOW(),NULL, 'tep_cfg_text_auto(', 1);

if not exists (select * from osc_configuration where configuration_key = 'CFG_CLASS_VIRTUAL_TYPE_4' )
insert into osc_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function , set_function,configuration_type) values ('CFG_CLASS_VIRTUAL_TYPE_4_S', 'CFG_CLASS_VIRTUAL_TYPE_4', '', 'CFG_CLASS_VIRTUAL_TYPE_L', '0', '0', NOW(), NOW(),NULL, 'tep_cfg_text_auto(', 1);

if not exists (select * from osc_configuration where configuration_key = 'TYPE_VIRTUAL_PRODUCTS' )
insert into osc_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function , set_function,configuration_type) values ('TYPE_VIRTUAL_PRODUCTS_S', 'TYPE_VIRTUAL_PRODUCTS', '', 'TYPE_VIRTUAL_PRODUCTS_L', '0', '0', NOW(), NOW(),NULL, NULL, 2);

if not exists (select * from osc_configuration where configuration_key = 'STOCK_MARK_PRODUCT_NO_STOCK' )
insert into osc_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, configuration_type) values ('STOCK_MARK_PRODUCT_NO_STOCK_S', 'STOCK_MARK_PRODUCT_NO_STOCK', '*cmd*', 'STOCK_MARK_PRODUCT_NO_STOCK_L', '9', '4', NOW(), NOW(), 3);

insert into osc_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function, configuration_type) values ('CUSTOMER_FORCE_UCWORDS_S', 'CUSTOMER_FORCE_UCWORDS', '6', 'CUSTOMER_FORCE_UCWORDS_L', '28', '20', NULL, NOW(), 'tep_value_for_humain', 'tep_cfg_select_option(array(\'true\', \'false\'),','3');
insert into osc_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function, configuration_type) values ('CUSTOMER_FORCE_STRTOUPPER_S', 'CUSTOMER_FORCE_STRTOUPPER', '10', 'CUSTOMER_FORCE_STRTOUPPER_L', '28', '21', NULL, NOW(), 'tep_value_for_humain', 'tep_cfg_select_option(array(\'true\', \'false\'),','3');

insert into osc_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function, configuration_type) values ('CUSTOMER_CITY_FORCE_STRTOUPPER_S', 'CUSTOMER_CITY_FORCE_STRTOUPPER', '10', 'CUSTOMER_CITY_FORCE_STRTOUPPER_L', '28', '21', NULL, NOW(), 'tep_value_for_humain', 'tep_cfg_select_option(array(\'true\', \'false\'),','3');

delete from osc_configuration where configuration_key='PRODINFO_ATTRIBUTE_PLUGIN' limit 1;


ALTER TABLE osc_orders ADD holding_origin_id INT( 11 ) NOT NULL ;

ALTER TABLE osc_holding_orders_products ADD products_stock_attributes VARCHAR( 255 ) NULL AFTER products_quantity ;

ALTER TABLE osc_orders ADD class_payment VARCHAR( 30 ) NOT NULL AFTER holding_origin_id ,
ADD class_shipping VARCHAR( 30 ) NOT NULL AFTER class_payment ;

ALTER TABLE osc_products CHANGE vendors_id track_stock INT( 1 ) NOT NULL DEFAULT 1;

ALTER TABLE osc_customers ADD COLUMN customers_language int(10) NOT NULL DEFAULT '1';
ALTER TABLE osc_customers ADD COLUMN customers_status int(1) NOT NULL DEFAULT '1';

ALTER TABLE osc_customers_groups ADD group_discount DECIMAL( 5, 2 ) NOT NULL DEFAULT '0.00';

ALTER TABLE osc_geo_zones ADD geo_zone_type TINYINT( 1 ) NOT NULL DEFAULT '1' AFTER geo_zone_id ;

if not exists (select * from osc_status where status_name = 'VAT' )
INSERT INTO osc_status VALUES (1, 'geo_zone_type', 1, 'VAT','');

if not exists (select * from osc_status where status_name = 'SHIPPING' )
INSERT INTO osc_status VALUES (2, 'geo_zone_type', 1, 'SHIPPING','');

ALTER TABLE osc_newsletters ADD COLUMN newsletters_language int(11) NOT NULL default '1';

drop table if exists osc_categories_extra;
CREATE TABLE IF NOT EXISTS osc_categories_extra (
  categories_id int(11) NOT NULL,
  cat_key varchar(150) NOT NULL,
  cat_value varchar(250) NOT NULL,
  UNIQUE KEY categories_id (categories_id,cat_key)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;