/* 2013-08-21 */
INSERT INTO `text_translation` (`var_id`, `modul`, `text`) VALUES ('nl_title', 'newsletter_widget', 'Newsletter');
INSERT INTO `text_translation` (`var_id`, `modul`, `text`) VALUES ('nl_infotext', 'newsletter_widget', 'Hier gibts ...');
INSERT INTO `text_translation` (`var_id`, `modul`, `text`) VALUES ('nl_footertext', 'newsletter_widget', 'Jetzt eintragen');

/* 2013-08-26 */
ALTER TABLE `structure`
	ADD COLUMN `root_id` INT(10) UNSIGNED NULL DEFAULT '0' AFTER `name_en`,
	ADD COLUMN `level` INT(10) UNSIGNED NULL DEFAULT '1' AFTER `root_id`;

/* 2013-08-27 */
ALTER TABLE `items`
	ADD COLUMN `has_additional_items` TINYINT UNSIGNED NULL DEFAULT '0' AFTER `detail_description_en`,
	ADD COLUMN `has_spare_parts` TINYINT UNSIGNED NULL DEFAULT '0' AFTER `has_additional_items`,
	ADD COLUMN `has_documents` TINYINT UNSIGNED NULL DEFAULT '0' AFTER `has_spare_parts`;

/* 2013-09-03 */
ALTER TABLE `item_files`
	ADD COLUMN `size` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `alt`;

INSERT INTO `configuration` (`name`, `group_id`, `setting`, `description`) VALUES ('show_item_item_assign', 'ITEM', '1', 'Zeige Zubehörartikel als Register');
INSERT INTO `configuration` (`name`, `group_id`, `setting`, `description`) VALUES ('show_item_item_assign2', 'ITEM', '1', 'Zeige Ersatzteile als Register');

/* 2013-09-12 */
ALTER TABLE `cancellation_reasons`
	ADD INDEX `active` (`active`);

ALTER TABLE `configuration`
	ADD INDEX `group_id` (`group_id`);

ALTER TABLE `countries`
	ADD INDEX `shipping_area_id` (`shipping_area_id`);

ALTER TABLE `country_customergroup_shippingarea`
	ADD INDEX `country_id` (`country_id`);

ALTER TABLE `country_customergroup_shippingarea`
	ADD INDEX `customer_group_id` (`customer_group_id`);

ALTER TABLE `country_customergroup_shippingarea`
	ADD INDEX `country_id_customer_group_id` (`country_id`, `customer_group_id`);

ALTER TABLE `customers`
	ADD INDEX `group_id` (`group_id`);

ALTER TABLE `customer_files`
	ADD INDEX `customer_id` (`customer_id`);

ALTER TABLE `customer_group_payment_method_configuration`
	ADD INDEX `group_id` (`group_id`),
	ADD INDEX `payment_method_id` (`payment_method_id`),
	ADD INDEX `shipping_area_id` (`shipping_area_id`),
	ADD INDEX `active` (`active`);

ALTER TABLE `deliverers`
	ADD INDEX `active` (`active`);

ALTER TABLE `discount_item`
	ADD INDEX `artikel_id` (`artikel_id`);

ALTER TABLE `export`
	ADD INDEX `customer_group_id` (`customer_group_id`),
	ADD INDEX `set_customer_group_id` (`set_customer_group_id`);

ALTER TABLE `export_item_groups`
	ADD INDEX `export_id` (`export_id`),
	ADD INDEX `structure_id` (`structure_id`);

ALTER TABLE `gift_certificates`
	ADD INDEX `active` (`active`),
	ADD INDEX `customer_id` (`customer_id`),
	ADD INDEX `customer_group_id` (`customer_group_id`);

ALTER TABLE `incomming_goods`
	ADD INDEX `vendor_id` (`vendor_id`);

ALTER TABLE `itemgroup_import`
	ADD INDEX `item_id` (`item_id`),
	ADD INDEX `group_id` (`group_id`),
	ADD INDEX `item_id_group_id` (`item_id`, `group_id`);

ALTER TABLE `items`
	ADD INDEX `parent_id` (`parent_id`),
	ADD INDEX `name` (`name`),
	ADD INDEX `structure_id` (`structure_id`),
	ADD INDEX `active` (`active`),
	ADD INDEX `short_uri` (`short_uri`),
	ADD INDEX `last_update` (`last_update`);

ALTER TABLE `item_attribute_variants`
	ADD INDEX `item_id` (`item_id`),
	ADD INDEX `customergroup_id` (`customergroup_id`);

ALTER TABLE `item_faq_assign`
	ADD INDEX `article_id` (`article_id`),
	ADD INDEX `faq_id` (`faq_id`),
	ADD INDEX `article_id_faq_id` (`article_id`, `faq_id`);

ALTER TABLE `item_files`
	ADD INDEX `item_id` (`item_id`),
	ADD INDEX `rang` (`rang`);

ALTER TABLE `item_inventory`
	ADD INDEX `item_id` (`item_id`);

ALTER TABLE `item_opinion`
	ADD INDEX `item_id` (`item_id`),
	ADD INDEX `active` (`active`),
	ADD INDEX `user_id` (`user_id`),
	ADD INDEX `rang` (`rang`);

ALTER TABLE `item_schema`
	ADD INDEX `active` (`active`);

ALTER TABLE `item_schema_attributes`
	ADD INDEX `schema_id` (`schema_id`);

ALTER TABLE `item_types`
	ADD INDEX `item_id` (`item_id`),
	ADD INDEX `item_type_definition_id` (`item_type_definition_id`);

ALTER TABLE `languages`
	ADD INDEX `active` (`active`);

ALTER TABLE `manufacturers`
	ADD INDEX `active` (`active`);

ALTER TABLE `marketing_manager_actions`
	ADD INDEX `active` (`active`);

ALTER TABLE `metatags`
	ADD INDEX `active` (`active`);

ALTER TABLE `nav`
	ADD INDEX `parentId` (`parentId`);

ALTER TABLE `news`
	ADD INDEX `active` (`active`);

ALTER TABLE `newsletter_attachments`
	ADD INDEX `newsletter_id` (`newsletter_id`);

ALTER TABLE `newsletter_items`
	ADD INDEX `item_id` (`item_id`);

ALTER TABLE `newsletter_recipient`
	ADD INDEX `customer_group_id` (`customer_group_id`);

ALTER TABLE `order_history`
	ADD INDEX `order_id` (`order_id`);

ALTER TABLE `order_item_return`
	ADD INDEX `order_id` (`order_id`);

ALTER TABLE `order_status`
	ADD INDEX `is_showable` (`is_showable`);

ALTER TABLE `payment_methods`
	ADD INDEX `configuration_group_id` (`configuration_group_id`);

ALTER TABLE `paypal_refund`
	ADD INDEX `order_id` (`order_id`);

ALTER TABLE `shipping_areas`
	ADD INDEX `shipping_area_is_active` (`shipping_area_is_active`);

ALTER TABLE `shipping_area_deliverers`
	ADD INDEX `active` (`active`);

ALTER TABLE `shipping_area_delivery_methods`
	ADD INDEX `shipping_area_id` (`shipping_area_id`),
	ADD INDEX `delivery_method_id` (`delivery_method_id`);

ALTER TABLE `shipping_area_item`
	ADD INDEX `artikel_id` (`artikel_id`),
	ADD INDEX `lieferzonen_id` (`lieferzonen_id`),
	ADD INDEX `artikel_id_lieferzonen_id` (`artikel_id`, `lieferzonen_id`);

ALTER TABLE `shipping_area_payment_methods`
	ADD INDEX `payment_method_id` (`payment_method_id`),
	ADD INDEX `shipping_area_id` (`shipping_area_id`);

ALTER TABLE `shipping_area_payment_method_customer_groups`
	ADD INDEX `shipping_area_id` (`shipping_area_id`),
	ADD INDEX `payment_method_id` (`payment_method_id`),
	ADD INDEX `customer_group_id` (`customer_group_id`);

ALTER TABLE `shop_opinion`
	ADD INDEX `active` (`active`);

ALTER TABLE `site_content`
	ADD INDEX `structure_id` (`structure_id`),
	ADD INDEX `activ` (`activ`),
	ADD INDEX `position` (`position`);

ALTER TABLE `standard_messages`
	ADD INDEX `active` (`active`);

ALTER TABLE `structure`
	ADD INDEX `theme_id` (`theme_id`),
	ADD INDEX `active` (`active`),
	ADD INDEX `show_after_login` (`show_after_login`),
	ADD INDEX `short_uri` (`short_uri`);

ALTER TABLE `structure`
	ADD INDEX `root_id` (`root_id`),
	ADD INDEX `level` (`level`);

ALTER TABLE `tickets`
	ADD INDEX `state_id` (`state_id`);

ALTER TABLE `ticket_message_attachments`
	ADD INDEX `ticket_message_id` (`ticket_message_id`);

ALTER TABLE `vendors`
	ADD INDEX `vendor_is_active` (`vendor_is_active`);

INSERT INTO `configuration` (`name`, `group_id`, `setting`, `description`) 
	VALUES ('menu_in_cashdesk', 'CASHDESK', '1', 'Soll im Cashdesk das Menü links angezeigt werden?');


/* 2013-09-13 */
ALTER TABLE `item_item_assign`
	CHANGE COLUMN `type` `type` TINYINT(10) NOT NULL DEFAULT '0' COMMENT '1: add. items; 2: spare parts; 3: real friends' AFTER `item_child_id`;

ALTER TABLE `items`
	ADD COLUMN `has_realfriends` TINYINT(3) UNSIGNED NULL DEFAULT '0' AFTER `has_documents`;

ALTER TABLE `items`
	CHANGE COLUMN `has_realfriends` `has_real_friends` TINYINT(3) UNSIGNED NULL DEFAULT '0' AFTER `has_documents`;

/* 2013-09-17 */
INSERT INTO `configuration` (`name`, `group_id`, `setting`, `description`) VALUES ('infinite_scrolling', 'ITEM_LIST', '1', 'Automatisches Nachladen in der Liste, wenn _alle_ gewählt.');

-- 2013-11-08
INSERT INTO `configuration` (`name`, `group_id`, `setting`) VALUES ('main_menu_item_clickable_if_empty', 'SITE_WIDGETS', '1');
UPDATE `configuration` SET `description`='Hauptmenüpunkte sind klickbar wenn ohne Unterpunkte' WHERE  `name`='main_menu_item_clickable_if_empty';

-- 2013-11-11
ALTER TABLE `items`
	ADD FULLTEXT INDEX `itemsearchindexft` (`number`, `name`, `detail_description`, `attribute_1`, `attribute_2`, `attribute_3`, `attribute_4`, `attribute_5`);

-- 2013-11-14
INSERT INTO `configuration` (`name`, `group_id`, `setting`, `description`) 
	VALUES ('custom_global_modules', 'SYSTEM', '1', 'Dieses Shop-System hat eigene Module (Themen-/Kunden-spezifisch)');

-- 2013-11-18
ALTER TABLE `items`
	ALTER `attribute_18` DROP DEFAULT;
ALTER TABLE `items`
	CHANGE COLUMN `attribute_18` `attribute_18` MEDIUMTEXT NULL AFTER `attribute_17`;

ALTER TABLE `items`
	ADD COLUMN `update_ready` TINYINT(3) UNSIGNED NULL DEFAULT '0' AFTER `has_real_friends`;

ALTER TABLE `items`
	DROP INDEX `itemsearchindexft`,
	ADD FULLTEXT INDEX `itemsearchindexft` (`number`, `name`, `detail_description`, `attribute_1`, `attribute_2`, `attribute_3`, `attribute_4`, `attribute_5`, `attribute_6`, `attribute_18`);

-- 2013-12-18
ALTER TABLE `domains`
	ALTER `google_site_verification` DROP DEFAULT,
	ALTER `google_analytics_code` DROP DEFAULT;
ALTER TABLE `domains`
	CHANGE COLUMN `google_site_verification` `google_site_verification` VARCHAR(255) NULL AFTER `name`,
	CHANGE COLUMN `google_analytics_code` `google_analytics_code` VARCHAR(255) NULL AFTER `standard_language_id`;

-- 2013-12-20
INSERT INTO `configuration` (`name`, `text`, `group_id`, `description`) VALUES ('shop_address_contact', 'formated', 'SHOP_TEXT', 'Adresse des Shops für Kontaktformular');

UPDATE `configuration` SET `description`='Adresse des Shopbetreibers für Adressbox' WHERE  `name`='shop_address';