DROP TABLE IF EXISTS products_to_support_packs;
 CREATE TABLE products_to_support_packs(
  product_id int(8) NOT NULL DEFAULT '0',
  subscription_id int(8) NOT NULL DEFAULT '0',
  no_users int(8) NOT NULL DEFAULT '0'
)ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS support_pack_order_history;
CREATE TABLE support_pack_order_history(
 support_pack_id int(11) NULL,
 license_code int(11) NULL,
 domain_name varchar(255),
 customer_email varchar(255),
 support_added datetime,
 minutes_used char(5)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS orders_products_support_packs;
CREATE TABLE `orders_products_support_packs` (
   `support_packs_id` int(11) NOT NULL auto_increment,
   `orders_id` int(11) default NULL,
   `products_id` int(11) default NULL,
   `subscription_id` int(11) default NULL,
   `subscription_name` varchar(255) default NULL,
   `no_users` int(11) default NULL,
   `support_minutes` int(11) default NULL,
    PRIMARY KEY  (`support_packs_id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
            
DROP TABLE IF EXISTS support_packs_license;
CREATE TABLE `support_packs_license` (
        `license_code` int(11) NOT NULL auto_increment,
        `support_packs_id` int(11) default NULL,
        `customer_domain` varchar(255) default NULL,
        `customer_name` varchar(125) default NULL,
        `customer_email` varchar(125) default NULL,
        `activation_time` datetime NOT NULL default '0000-00-00 00:00:00',
        `activate` char(1) default 'N',
        `email_sent` int(3) NOT NULL default '0',
        PRIMARY KEY  (`license_code`)
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

ALTER TABLE `subscriptions` ADD `support_minutes` INT(2) NULL;
ALTER TABLE `products` ADD `product_type` CHAR(1) NOT NULL DEFAULT 'G';
ALTER TABLE orders_products add support_packs_type char(1) default 'G'; 
ALTER TABLE `products_reminders` ADD `quantity` INT(6) NOT NULL DEFAULT '0';

INSERT INTO `admin_menus` (`menu_id`, `parent_id`, `admin_groups_id`, `menu_pos`,  `filename`, `params`, `menu_item_type`) VALUES  (317,60,'1',317,'marketing_support_pack.php','','P');
INSERT INTO  admin_menus values(320,104,1,320,'reports_resellers.php','','P');
INSERT INTO `admin_menus_description` (`menu_id`, `menu_text`, `language_id`) VALUES (317,'Support Packs',1);
INSERT INTO  admin_menus_description values(320,'Resellers',1);
INSERT INTO  admin_files values(NULL,'reports_resellers.php',1,8,1,'D','D',20);
INSERT INTO  admin_files (admin_files_name, admin_files_is_boxes, admin_files_to_boxes,  admin_groups_id,admin_new_group_id) values ('marketing_support_pack.php',0,0,'1','15');
INSERT INTO  admin_files (admin_files_name, admin_files_is_boxes, admin_files_to_boxes,  admin_groups_id,`admin_new_group_id`) values ('support_pack_cron_jobs.php',0,0,'1','28');

INSERT into sql_queries values('freeway_v1_3_0.sql',now());
