
DROP TABLE IF EXISTS `m3_email_pay_gateway_events`;
CREATE TABLE IF NOT EXISTS `m3_email_pay_gateway_events` (
  `id` bigint(22) unsigned NOT NULL auto_increment,
  `alias` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `tags` text NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;


INSERT INTO `m3_email_pay_gateway_events` (`id`, `alias`, `name`, `tags`) VALUES(1, 'gateway_specific', 'Pay Gatway Specific', 'name,order_id,email_signature');


DROP TABLE IF EXISTS `m3_email_pay_gateway_specific_jtemplate`;
CREATE TABLE IF NOT EXISTS `m3_email_pay_gateway_specific_jtemplate` (
  `template_id` bigint(22) NOT NULL,
  `gateway_id` bigint(22) NOT NULL,
  KEY `template_id` (`template_id`,`gateway_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `m3_email_pay_gateway_templates`;
CREATE TABLE IF NOT EXISTS `m3_email_pay_gateway_templates` (
  `id` bigint(22) unsigned NOT NULL auto_increment,
  `event_alias` varchar(255) NOT NULL,
  `email_configuration_id` bigint(22) NOT NULL,
  `is_custom` enum('No','Yes') NOT NULL default 'Yes',
  `type` enum('text','html') NOT NULL,
  `priority` enum('1','3','5') NOT NULL,
  `cc` text NOT NULL,
  `bcc` text NOT NULL,
  `subject` text NOT NULL,
  `message` text NOT NULL,
  `created` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;

ALTER TABLE  `m3_packages` ADD  `assets_issued` ENUM(  'No',  'Yes' ) NOT NULL DEFAULT  'No' AFTER  `parent_package_id`;




DROP TABLE IF EXISTS `m3_email_download_control_events`;
CREATE TABLE IF NOT EXISTS `m3_email_download_control_events` (
  `id` bigint(22) unsigned NOT NULL auto_increment,
  `alias` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `tags` text NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;


INSERT INTO `m3_email_download_control_events` (`id`, `alias`, `name`, `tags`) VALUES(1, 'download_control_specific', 'Download Control Specific', 'product_name,sku_name,control_name,expired_date,email_signature');


DROP TABLE IF EXISTS `m3_email_download_control_specific_jtemplate`;
CREATE TABLE IF NOT EXISTS `m3_email_download_control_specific_jtemplate` (
  `template_id` bigint(22) NOT NULL,
  `control_id` bigint(22) NOT NULL,
  KEY `template_id` (`template_id`,`control_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `m3_email_download_control_templates`;
CREATE TABLE IF NOT EXISTS `m3_email_download_control_templates` (
  `id` bigint(22) unsigned NOT NULL auto_increment,
  `event_alias` varchar(255) NOT NULL,
  `email_configuration_id` bigint(22) NOT NULL,
  `is_custom` enum('No','Yes') NOT NULL default 'Yes',
  `type` enum('text','html') NOT NULL,
  `priority` enum('1','3','5') NOT NULL,
  `cc` text NOT NULL,
  `bcc` text NOT NULL,
  `subject` text NOT NULL,
  `message` text NOT NULL,
  `created` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;

INSERT INTO `m3_cron` (`parent_mod`, `job`, `name`, `description`, `day`, `hour`, `status`, `last_ran`, `created`) VALUES('download_control', 'download_control_expired', 'Download Control Expired', 'Sends an e-mail to the customer when a product download control has expired.', 'Every', 'Every', 'Enabled', 0, 1261433151);

ALTER TABLE  `m3_customer_download_control` CHANGE  `status`  `status` ENUM(  'Active',  'Suspended',  'Expired' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT  'Active' ;




DROP TABLE IF EXISTS `m3_email_support_package_events`;
CREATE TABLE IF NOT EXISTS `m3_email_support_package_events` (
  `id` bigint(22) unsigned NOT NULL auto_increment,
  `alias` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `tags` text NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;


INSERT INTO `m3_email_support_package_events` (`id`, `alias`, `name`, `tags`) VALUES(1, 'support_package_specific', 'Support Package Specific', 'product_name,sku_name,support_package_name,expired_date,email_signature');


DROP TABLE IF EXISTS `m3_email_support_package_specific_jtemplate`;
CREATE TABLE IF NOT EXISTS `m3_email_support_package_specific_jtemplate` (
  `template_id` bigint(22) NOT NULL,
  `support_package_id` bigint(22) NOT NULL,
  KEY `template_id` (`template_id`,`support_package_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `m3_email_support_package_templates`;
CREATE TABLE IF NOT EXISTS `m3_email_support_package_templates` (
  `id` bigint(22) unsigned NOT NULL auto_increment,
  `event_alias` varchar(255) NOT NULL,
  `email_configuration_id` bigint(22) NOT NULL,
  `is_custom` enum('No','Yes') NOT NULL default 'Yes',
  `type` enum('text','html') NOT NULL,
  `priority` enum('1','3','5') NOT NULL,
  `cc` text NOT NULL,
  `bcc` text NOT NULL,
  `subject` text NOT NULL,
  `message` text NOT NULL,
  `created` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;

INSERT INTO `m3_cron` (`parent_mod`, `job`, `name`, `description`, `day`, `hour`, `status`, `last_ran`, `created`) VALUES('support_package', 'support_package_expired', 'Support Package Expired', 'Sends an e-mail to the customer when a product support package has expired.', 'Every', 'Every', 'Enabled', 0, 1261433151);

ALTER TABLE  `m3_customer_support_packages` CHANGE  `status`  `status` ENUM(  'Active',  'Suspended',  'Expired' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT  'Active' ;



INSERT INTO `m3_email_customer_area_events` (`alias` , `name` , `tags` ) VALUES ( 'new_account_information', 'New Account Information', 'first_name,last_name,email,username,password,email_signature');
INSERT INTO `m3_email_customer_area_templates` (`event_alias`, `email_configuration_id`, `is_custom`, `type`, `priority`, `cc`, `bcc`, `subject`, `message`, `created`) VALUES('new_account_information', 1, 'No', 'text', '3', '', '', 'Your new account information', 'Thank you for registering {first_name}! Here are your login details:\r\n\r\nName: {first_name} {last_name}\r\nE-mail: {email}\r\nUsername: {username}\r\nPassword: {password}\r\n\r\n{email_signature}', 1262035545);

INSERT INTO `m3_email_order_form_events` (`alias` , `name` , `tags` ) VALUES ( 'new_account_information', 'New Account Information', 'first_name,last_name,email,username,password,email_signature');
INSERT INTO `m3_email_order_form_templates` (`event_alias`, `email_configuration_id`, `is_custom`, `type`, `priority`, `cc`, `bcc`, `subject`, `message`, `created`) VALUES('new_account_information', 1, 'No', 'text', '3', '', '', 'Your new account information', 'Thank you for registering {first_name}! Here are your login details:\r\n\r\nName: {first_name} {last_name}\r\nE-mail: {email}\r\nUsername: {username}\r\nPassword: {password}\r\n\r\n{email_signature}', 1262035545);




DROP TABLE IF EXISTS `m3_email_invoice_events`;
CREATE TABLE IF NOT EXISTS `m3_email_invoice_events` (
  `id` bigint(22) unsigned NOT NULL auto_increment,
  `alias` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `tags` text NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;


INSERT INTO `m3_email_invoice_events` (`id`, `alias`, `name`, `tags`) VALUES(1, 'new_invoice', 'New Invoice', 'first_name,invoice_link,email_signature');


DROP TABLE IF EXISTS `m3_email_invoice_templates`;
CREATE TABLE IF NOT EXISTS `m3_email_invoice_templates` (
  `id` bigint(22) unsigned NOT NULL auto_increment,
  `event_alias` varchar(255) NOT NULL,
  `email_configuration_id` bigint(22) NOT NULL,
  `is_custom` enum('No','Yes') NOT NULL default 'Yes',
  `type` enum('text','html') NOT NULL,
  `priority` enum('1','3','5') NOT NULL,
  `cc` text NOT NULL,
  `bcc` text NOT NULL,
  `subject` text NOT NULL,
  `message` text NOT NULL,
  `created` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;


INSERT INTO `m3_email_invoice_templates` (`event_alias`, `email_configuration_id`, `is_custom`, `type`, `priority`, `cc`, `bcc`, `subject`, `message`, `created`) VALUES('new_invoice', 1, 'No', 'text', '3', '', '', 'You have a new invoice', 'Greetings {first_name},\r\nA new invoice was just added to your account. Here\\&#039;s a direct link to the invoice:\r\n\r\n{invoice_link}\r\n\r\n{email_signature}', 1262052860);



ALTER TABLE  `m3_cart_sessions` ADD  `order_form_id` BIGINT( 11 ) NOT NULL AFTER  `order_id`;
ALTER TABLE  `m3_cart_sessions` ADD  `customer_area_id` BIGINT( 22 ) NOT NULL AFTER  `customer_id`;






DROP TABLE IF EXISTS `m3_pay_gateway_clickbank_jproduct`;
CREATE TABLE IF NOT EXISTS `m3_pay_gateway_clickbank_jproduct` (
  `pay_gateway_id` bigint(22) NOT NULL,
  `clickbank_id` tinyint(3) NOT NULL,
  `sku_id` bigint(22) NOT NULL,
  KEY `pay_gateway_id` (`pay_gateway_id`,`clickbank_id`,`sku_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;




ALTER TABLE `m3_order_parts` ADD `sku_pricing_id` BIGINT( 22 ) NOT NULL AFTER `sku_id` ;
ALTER TABLE `m3_cart_sessions` ADD `price_sheet_id` BIGINT( 22 ) NOT NULL AFTER `user_id` ;



ALTER TABLE `m3_fw_language_masks` DROP `created` ;
ALTER TABLE `m3_fw_language_masks` DROP `updated` ;



ALTER TABLE `m3_product_jaddons` ADD `display_order` BIGINT( 22 ) NOT NULL ;


ALTER TABLE `m3_users` ADD `max_rows` VARCHAR( 3 ) NOT NULL DEFAULT '5' AFTER `email_ok`;


DROP TABLE IF EXISTS `m3_product_sku_jexclude_addons`;
CREATE TABLE IF NOT EXISTS `m3_product_sku_jexclude_addons` (
  `sku_id` bigint(22) NOT NULL,
  `addon_sku_id` bigint(22) NOT NULL,
  KEY `sku_id` (`sku_id`,`addon_sku_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; 