ALTER TABLE `m3_packages` ADD `status` ENUM( 'Active', 'Suspended' ) NOT NULL DEFAULT 'Active' AFTER `package_type` ;
ALTER TABLE `m3_customer_download_control` ADD `status` ENUM( 'Active', 'Suspended' ) NOT NULL DEFAULT 'Active' AFTER `expires` ;
ALTER TABLE `m3_customer_media_sets` ADD `status` ENUM( 'Active', 'Suspended' ) NOT NULL DEFAULT 'Active' AFTER `name` ;
ALTER TABLE `m3_customer_support_packages` ADD `status` ENUM( 'Active', 'Suspended' ) NOT NULL DEFAULT 'Active' AFTER `expires` ;

ALTER TABLE `m3_products` CHANGE `status` `status` ENUM( 'Public', 'Private', 'Renewal', 'Admin Only', 'Disabled - Legacy', 'Disabled - Discontinued' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'Public';

DROP TABLE IF EXISTS `m3_product_jrenewals`;
CREATE TABLE IF NOT EXISTS `m3_product_jrenewals` (
  `product_sku_id` bigint(22) NOT NULL,
  `renewal_product_id` bigint(22) NOT NULL,
  KEY `product_sku_id` (`product_sku_id`,`renewal_product_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

ALTER TABLE `m3_cart_items` ADD `package_id` BIGINT( 22 ) NOT NULL AFTER `sku_id` ; 
ALTER TABLE `m3_order_parts` ADD `parent_package_id` BIGINT( 22 ) NOT NULL AFTER `package_id` ;

ALTER TABLE `m3_media_download_control` CHANGE `term_str` `term_str` ENUM( 'Year', 'Month', 'Week', 'Day', 'Hour', 'Minute' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ;
ALTER TABLE `m3_media_download_control` ADD `after_expiration` ENUM( 'disable', 'limit' ) NOT NULL DEFAULT 'disable' AFTER `term_str` ;

DROP TABLE IF EXISTS `m3_email_product_events`;
CREATE TABLE IF NOT EXISTS `m3_email_product_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 AUTO_INCREMENT=4 ;

INSERT INTO `m3_email_product_events` (`id`, `alias`, `name`, `tags`) VALUES(1, 'order_under_review', 'Order Under Review', 'product_name,order_id,email_signature');
INSERT INTO `m3_email_product_events` (`id`, `alias`, `name`, `tags`) VALUES(2, 'product_specific', 'Product Specific', 'product_name,price_tier_name,product_id,order_id,email_signature');
INSERT INTO `m3_email_product_events` (`id`, `alias`, `name`, `tags`) VALUES(3, 'order_approved_after_review', 'Order Approved After Review', 'product_name,order_id,email_signature');


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

DROP TABLE IF EXISTS `m3_spbas_announcements`;
CREATE TABLE IF NOT EXISTS `m3_spbas_announcements` (
  `id` bigint(22) unsigned NOT NULL auto_increment,
  `link` text NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `created` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;


INSERT INTO `m3_cron` (`id`, `parent_mod`, `job`, `name`, `description`, `day`, `hour`, `status`, `last_ran`, `created`) VALUES('', '', 'spbas_announcement_grabber', 'SPBAS Announcements', 'SPBAS Announcements', 'Every', 'Every', 'Enabled', 1259361746, 1259360671);

DROP TABLE IF EXISTS `m3_customer_area_categories`;
CREATE TABLE IF NOT EXISTS `m3_customer_area_categories` (
  `id` bigint(22) unsigned NOT NULL auto_increment,
  `parent_id` bigint(22) unsigned NOT NULL,
  `customer_area_id` bigint(22) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `icon` varchar(255) NOT NULL,
  `status` enum('Public','Private') NOT NULL,
  `created` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `m3_customer_area_media`;
CREATE TABLE IF NOT EXISTS `m3_customer_area_media` (
  `id` bigint(22) unsigned NOT NULL auto_increment,
  `category_id` bigint(22) NOT NULL,
  `customer_area_id` bigint(22) NOT NULL,
  `alias` varchar(32) NOT NULL,
  `name` varchar(255) NOT NULL,
  `filename` varchar(255) NOT NULL,
  `mime_type` varchar(255) NOT NULL,
  `downloaded` bigint(22) NOT NULL,
  `created` int(11) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `category_id` (`category_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

TRUNCATE TABLE `m3_spbas_announcements` ;
TRUNCATE TABLE `m3_sphps_blog` ;