text: 
  SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
  SET FOREIGN_KEY_CHECKS=0;
  
  DROP TABLE IF EXISTS `#__tax_calculation_rate`;
  CREATE TABLE `#__tax_calculation_rate` (
    `tax_calculation_rate_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Tax Calculation Rate Id',
    `tax_country_id` varchar(2) NOT NULL COMMENT 'Tax Country Id',
    `tax_region_id` int(11) NOT NULL COMMENT 'Tax Region Id',
    `tax_postcode` varchar(21) DEFAULT NULL COMMENT 'Tax Postcode',
    `code` varchar(255) NOT NULL COMMENT 'Code',
    `rate` decimal(12,4) NOT NULL COMMENT 'Rate',
    `zip_is_range` smallint(6) DEFAULT NULL COMMENT 'Zip Is Range',
    `zip_from` int(10) unsigned DEFAULT NULL COMMENT 'Zip From',
    `zip_to` int(10) unsigned DEFAULT NULL COMMENT 'Zip To',
    PRIMARY KEY (`tax_calculation_rate_id`),
    KEY `TAX_CALCULATION_RATE_TAX_COUNTRY_ID_TAX_REGION_ID_TAX_POSTCODE` (`tax_country_id`,`tax_region_id`,`tax_postcode`),
    KEY `TAX_CALCULATION_RATE_CODE` (`code`),
    KEY `IDX_CA799F1E2CB843495F601E56C84A626D` (`tax_calculation_rate_id`,`tax_country_id`,`tax_region_id`,`zip_is_range`,`tax_postcode`)
  ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='Tax Calculation Rate';
  
  INSERT INTO tax_calculation_rate VALUES ('1', 'US', '12', '*', 'US-CA-*-Rate 1', '8.2500', null, null, null);
  INSERT INTO tax_calculation_rate VALUES ('2', 'US', '43', '*', 'US-NY-*-Rate 1', '8.3750', null, null, null);
  
  DROP TABLE IF EXISTS `#__tax_calculation_rate_title`;
  CREATE TABLE `#__tax_calculation_rate_title` (
    `tax_calculation_rate_title_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Tax Calculation Rate Title Id',
    `tax_calculation_rate_id` int(11) NOT NULL COMMENT 'Tax Calculation Rate Id',
    `store_id` smallint(5) unsigned NOT NULL COMMENT 'Store Id',
    `value` varchar(255) NOT NULL COMMENT 'Value',
    PRIMARY KEY (`tax_calculation_rate_title_id`),
    KEY `TAX_CALCULATION_RATE_TITLE_TAX_CALCULATION_RATE_ID_STORE_ID` (`tax_calculation_rate_id`,`store_id`),
    KEY `TAX_CALCULATION_RATE_TITLE_STORE_ID` (`store_id`),
    CONSTRAINT `FK_37FB965F786AD5897BB3AE90470C42AB` FOREIGN KEY (`tax_calculation_rate_id`) REFERENCES `#__tax_calculation_rate` (`tax_calculation_rate_id`) ON DELETE CASCADE,
    CONSTRAINT `TAX_CALCULATION_RATE_TITLE_STORE_ID_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `#__store` (`store_id`) ON DELETE CASCADE
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Tax Calculation Rate Title';
  
  DROP TABLE IF EXISTS `#__tax_calculation_rule`;
  CREATE TABLE `#__tax_calculation_rule` (
    `tax_calculation_rule_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Tax Calculation Rule Id',
    `code` varchar(255) NOT NULL COMMENT 'Code',
    `priority` int(11) NOT NULL COMMENT 'Priority',
    `position` int(11) NOT NULL COMMENT 'Position',
    `calculate_subtotal` int(11) NOT NULL COMMENT 'Calculate off subtotal option',
    PRIMARY KEY (`tax_calculation_rule_id`),
    KEY `TAX_CALCULATION_RULE_PRIORITY_POSITION` (`priority`,`position`),
    KEY `TAX_CALCULATION_RULE_CODE` (`code`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Tax Calculation Rule';
  
  DROP TABLE IF EXISTS `#__tax_calculation`;
  CREATE TABLE `#__tax_calculation` (
    `tax_calculation_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Tax Calculation Id',
    `tax_calculation_rate_id` int(11) NOT NULL COMMENT 'Tax Calculation Rate Id',
    `tax_calculation_rule_id` int(11) NOT NULL COMMENT 'Tax Calculation Rule Id',
    `customer_tax_class_id` smallint(6) NOT NULL COMMENT 'Customer Tax Class Id',
    `product_tax_class_id` smallint(6) NOT NULL COMMENT 'Product Tax Class Id',
    PRIMARY KEY (`tax_calculation_id`),
    KEY `IDX_TAX_CALCULATION_TAX_CALCULATION_RULE_ID` (`tax_calculation_rule_id`),
    KEY `IDX_TAX_CALCULATION_CUSTOMER_TAX_CLASS_ID` (`customer_tax_class_id`),
    KEY `IDX_TAX_CALCULATION_PRODUCT_TAX_CLASS_ID` (`product_tax_class_id`),
    KEY `IDX_TAX_CALC_TAX_CALC_RATE_ID_CSTR_TAX_CLASS_ID_PRD_TAX_CLASS_ID` (`tax_calculation_rate_id`,`customer_tax_class_id`,`product_tax_class_id`),
    CONSTRAINT `FK_TAX_CALCULATION_PRODUCT_TAX_CLASS_ID_TAX_CLASS_CLASS_ID` FOREIGN KEY (`product_tax_class_id`) REFERENCES `#__tax_class` (`class_id`) ON DELETE CASCADE,
    CONSTRAINT `FK_TAX_CALCULATION_CUSTOMER_TAX_CLASS_ID_TAX_CLASS_CLASS_ID` FOREIGN KEY (`customer_tax_class_id`) REFERENCES `#__tax_class` (`class_id`) ON DELETE CASCADE,
    CONSTRAINT `FK_TAX_CALC_TAX_CALC_RATE_ID_TAX_CALC_RATE_TAX_CALC_RATE_ID` FOREIGN KEY (`tax_calculation_rate_id`) REFERENCES `#__tax_calculation_rate` (`tax_calculation_rate_id`) ON DELETE CASCADE,
    CONSTRAINT `FK_TAX_CALC_TAX_CALC_RULE_ID_TAX_CALC_RULE_TAX_CALC_RULE_ID` FOREIGN KEY (`tax_calculation_rule_id`) REFERENCES `#__tax_calculation_rule` (`tax_calculation_rule_id`) ON DELETE CASCADE
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Tax Calculation';
  
  DROP TABLE IF EXISTS `#__tax_order_aggregated_created`;
  CREATE TABLE `#__tax_order_aggregated_created` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Id',
    `period` date DEFAULT NULL COMMENT 'Period',
    `store_id` smallint(5) unsigned DEFAULT NULL COMMENT 'Store Id',
    `code` varchar(255) NOT NULL COMMENT 'Code',
    `order_status` varchar(50) NOT NULL COMMENT 'Order Status',
    `percent` float DEFAULT NULL COMMENT 'Percent',
    `orders_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Orders Count',
    `tax_base_amount_sum` float DEFAULT NULL COMMENT 'Tax Base Amount Sum',
    PRIMARY KEY (`id`),
    UNIQUE KEY `TAX_ORDER_AGGRED_CREATED_PERIOD_STORE_ID_CODE_PERCENT_ORDER_STS` (`period`,`store_id`,`code`,`percent`,`order_status`),
    KEY `TAX_ORDER_AGGREGATED_CREATED_STORE_ID` (`store_id`),
    CONSTRAINT `TAX_ORDER_AGGREGATED_CREATED_STORE_ID_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `#__store` (`store_id`) ON DELETE CASCADE
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Tax Order Aggregation';
  
  DROP TABLE IF EXISTS `#__tax_order_aggregated_updated`;
  CREATE TABLE `#__tax_order_aggregated_updated` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Id',
    `period` date DEFAULT NULL COMMENT 'Period',
    `store_id` smallint(5) unsigned DEFAULT NULL COMMENT 'Store Id',
    `code` varchar(255) NOT NULL COMMENT 'Code',
    `order_status` varchar(50) NOT NULL COMMENT 'Order Status',
    `percent` float DEFAULT NULL COMMENT 'Percent',
    `orders_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Orders Count',
    `tax_base_amount_sum` float DEFAULT NULL COMMENT 'Tax Base Amount Sum',
    PRIMARY KEY (`id`),
    UNIQUE KEY `TAX_ORDER_AGGRED_UPDATED_PERIOD_STORE_ID_CODE_PERCENT_ORDER_STS` (`period`,`store_id`,`code`,`percent`,`order_status`),
    KEY `TAX_ORDER_AGGREGATED_UPDATED_STORE_ID` (`store_id`),
    CONSTRAINT `TAX_ORDER_AGGREGATED_UPDATED_STORE_ID_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `#__store` (`store_id`) ON DELETE CASCADE
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Tax Order Aggregated Updated';
  
  DROP TABLE IF EXISTS `#__catalogrule`;
  CREATE TABLE `#__catalogrule` (
    `rule_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Rule Id',
    `name` varchar(255) DEFAULT NULL COMMENT 'Name',
    `description` text COMMENT 'Description',
    `from_date` date DEFAULT NULL COMMENT 'From',
    `to_date` date DEFAULT NULL COMMENT 'To',
    `is_active` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Is Active',
    `conditions_serialized` mediumtext COMMENT 'Conditions Serialized',
    `actions_serialized` mediumtext COMMENT 'Actions Serialized',
    `stop_rules_processing` smallint(6) NOT NULL DEFAULT '1' COMMENT 'Stop Rules Processing',
    `sort_order` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Sort Order',
    `simple_action` varchar(32) DEFAULT NULL COMMENT 'Simple Action',
    `discount_amount` decimal(12,4) NOT NULL DEFAULT '0.0000' COMMENT 'Discount Amount',
    `sub_is_enable` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Is Rule Enable For Subitems',
    `sub_simple_action` varchar(32) DEFAULT NULL COMMENT 'Simple Action For Subitems',
    `sub_discount_amount` decimal(12,4) NOT NULL DEFAULT '0.0000' COMMENT 'Discount Amount For Subitems',
    PRIMARY KEY (`rule_id`),
    KEY `CATALOGRULE_IS_ACTIVE_SORT_ORDER_TO_DATE_FROM_DATE` (`is_active`,`sort_order`,`to_date`,`from_date`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='CatalogRule';
  
  DROP TABLE IF EXISTS `#__catalogrule_customer_group`;
  CREATE TABLE `#__catalogrule_customer_group` (
    `rule_id` int(10) unsigned NOT NULL COMMENT 'Rule Id',
    `customer_group_id` smallint(5) unsigned NOT NULL COMMENT 'Customer Group Id',
    PRIMARY KEY (`rule_id`,`customer_group_id`),
    KEY `CATALOGRULE_CUSTOMER_GROUP_CUSTOMER_GROUP_ID` (`customer_group_id`),
    CONSTRAINT `CATALOGRULE_CUSTOMER_GROUP_RULE_ID_CATALOGRULE_RULE_ID` FOREIGN KEY (`rule_id`) REFERENCES `#__catalogrule` (`rule_id`) ON DELETE CASCADE,
    CONSTRAINT `CATRULE_CSTR_GROUP_CSTR_GROUP_ID_CSTR_GROUP_CSTR_GROUP_ID` FOREIGN KEY (`customer_group_id`) REFERENCES `#__customer_group` (`customer_group_id`) ON DELETE CASCADE
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Rules To Customer Groups Relations';
  
  DROP TABLE IF EXISTS `#__catalogrule_group_website`;
  CREATE TABLE `#__catalogrule_group_website` (
    `rule_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Rule Id',
    `customer_group_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Customer Group Id',
    `website_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Website Id',
    PRIMARY KEY (`rule_id`,`customer_group_id`,`website_id`),
    KEY `CATALOGRULE_GROUP_WEBSITE_CUSTOMER_GROUP_ID` (`customer_group_id`),
    KEY `CATALOGRULE_GROUP_WEBSITE_WEBSITE_ID` (`website_id`),
    CONSTRAINT `CATALOGRULE_GROUP_WEBSITE_RULE_ID_CATALOGRULE_RULE_ID` FOREIGN KEY (`rule_id`) REFERENCES `#__catalogrule` (`rule_id`) ON DELETE CASCADE,
    CONSTRAINT `CATALOGRULE_GROUP_WEBSITE_WEBSITE_ID_STORE_WEBSITE_WEBSITE_ID` FOREIGN KEY (`website_id`) REFERENCES `#__store_website` (`website_id`) ON DELETE CASCADE,
    CONSTRAINT `CATRULE_GROUP_WS_CSTR_GROUP_ID_CSTR_GROUP_CSTR_GROUP_ID` FOREIGN KEY (`customer_group_id`) REFERENCES `#__customer_group` (`customer_group_id`) ON DELETE CASCADE
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='CatalogRule Group Website';
  
  DROP TABLE IF EXISTS `#__catalogrule_product`;
  CREATE TABLE `#__catalogrule_product` (
    `rule_product_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Rule Product Id',
    `rule_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Rule Id',
    `from_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'From Time',
    `to_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'To time',
    `customer_group_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Customer Group Id',
    `product_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Product Id',
    `action_operator` varchar(10) DEFAULT 'to_fixed' COMMENT 'Action Operator',
    `action_amount` decimal(12,4) NOT NULL DEFAULT '0.0000' COMMENT 'Action Amount',
    `action_stop` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Action Stop',
    `sort_order` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Sort Order',
    `website_id` smallint(5) unsigned NOT NULL COMMENT 'Website Id',
    `sub_simple_action` varchar(32) DEFAULT NULL COMMENT 'Simple Action For Subitems',
    `sub_discount_amount` decimal(12,4) NOT NULL DEFAULT '0.0000' COMMENT 'Discount Amount For Subitems',
    PRIMARY KEY (`rule_product_id`),
    UNIQUE KEY `IDX_EAA51B56FF092A0DCB795D1CEF812B7B` (`rule_id`,`from_time`,`to_time`,`website_id`,`customer_group_id`,`product_id`,`sort_order`),
    KEY `CATALOGRULE_PRODUCT_CUSTOMER_GROUP_ID` (`customer_group_id`),
    KEY `CATALOGRULE_PRODUCT_WEBSITE_ID` (`website_id`),
    KEY `CATALOGRULE_PRODUCT_FROM_TIME` (`from_time`),
    KEY `CATALOGRULE_PRODUCT_TO_TIME` (`to_time`),
    KEY `CATALOGRULE_PRODUCT_PRODUCT_ID` (`product_id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='CatalogRule Product';
  
  DROP TABLE IF EXISTS `#__catalogrule_product_price`;
  CREATE TABLE `#__catalogrule_product_price` (
    `rule_product_price_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Rule Product PriceId',
    `rule_date` date NOT NULL COMMENT 'Rule Date',
    `customer_group_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Customer Group Id',
    `product_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Product Id',
    `rule_price` decimal(12,4) NOT NULL DEFAULT '0.0000' COMMENT 'Rule Price',
    `website_id` smallint(5) unsigned NOT NULL COMMENT 'Website Id',
    `latest_start_date` date DEFAULT NULL COMMENT 'Latest StartDate',
    `earliest_end_date` date DEFAULT NULL COMMENT 'Earliest EndDate',
    PRIMARY KEY (`rule_product_price_id`),
    UNIQUE KEY `CATRULE_PRD_PRICE_RULE_DATE_WS_ID_CSTR_GROUP_ID_PRD_ID` (`rule_date`,`website_id`,`customer_group_id`,`product_id`),
    KEY `CATALOGRULE_PRODUCT_PRICE_CUSTOMER_GROUP_ID` (`customer_group_id`),
    KEY `CATALOGRULE_PRODUCT_PRICE_WEBSITE_ID` (`website_id`),
    KEY `CATALOGRULE_PRODUCT_PRICE_PRODUCT_ID` (`product_id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='CatalogRule Product Price';
  
  DROP TABLE IF EXISTS `#__catalogrule_website`;
  CREATE TABLE `#__catalogrule_website` (
    `rule_id` int(10) unsigned NOT NULL COMMENT 'Rule Id',
    `website_id` smallint(5) unsigned NOT NULL COMMENT 'Website Id',
    PRIMARY KEY (`rule_id`,`website_id`),
    KEY `CATALOGRULE_WEBSITE_WEBSITE_ID` (`website_id`),
    CONSTRAINT `CATALOGRULE_WEBSITE_RULE_ID_CATALOGRULE_RULE_ID` FOREIGN KEY (`rule_id`) REFERENCES `#__catalogrule` (`rule_id`) ON DELETE CASCADE,
    CONSTRAINT `CATALOGRULE_WEBSITE_WEBSITE_ID_STORE_WEBSITE_WEBSITE_ID` FOREIGN KEY (`website_id`) REFERENCES `#__store_website` (`website_id`) ON DELETE CASCADE
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Rules To Websites Relations';
  
  SET FOREIGN_KEY_CHECKS=1;