/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `ab_account_billing`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_account_billing` (
  `id` int(11) NOT NULL,
  `site_id` int(11) NOT NULL,
  `account_id` bigint(20) DEFAULT NULL,
  `checkout_id` int(11) NOT NULL,
  `service_id` bigint(20) DEFAULT NULL,
  `checkout_data` blob DEFAULT NULL,
  `checkout_amount` double DEFAULT NULL,
  `notes` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`checkout_id`),
  UNIQUE KEY `UNIQUE` (`site_id`,`service_id`),
  KEY `fk_ab_a` (`account_id`,`site_id`),
  KEY `fk_ab_s` (`service_id`,`site_id`),
  CONSTRAINT `fk_ab_a` FOREIGN KEY (`account_id`, `site_id`) REFERENCES `accounts` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ab_s` FOREIGN KEY (`service_id`, `site_id`) REFERENCES `ab_service` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_account_group`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_account_group` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_start` bigint(20) DEFAULT NULL,
  `date_expire` bigint(20) DEFAULT NULL,
  `group_id` int(11) NOT NULL DEFAULT 0,
  `account_id` bigint(20) NOT NULL DEFAULT 0,
  `service_id` bigint(20) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`account_id`,`group_id`),
  UNIQUE KEY `UNIQUE` (`site_id`,`group_id`,`account_id`),
  KEY `fk_ag_acc_idx` (`account_id`,`site_id`),
  KEY `fk_ag_grp_idx` (`group_id`,`site_id`),
  CONSTRAINT `fk_ag_acc` FOREIGN KEY (`account_id`, `site_id`) REFERENCES `accounts` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ag_grp` FOREIGN KEY (`group_id`, `site_id`) REFERENCES `ab_group` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_account_log`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_account_log` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `account_id` bigint(20) NOT NULL DEFAULT 0,
  `ip` varchar(32) DEFAULT NULL,
  `details` varchar(256) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`account_id`),
  KEY `fk_al_acc_idx` (`account_id`,`site_id`),
  CONSTRAINT `fk_al_acc` FOREIGN KEY (`account_id`, `site_id`) REFERENCES `accounts` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_account_memo`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_account_memo` (
  `id` bigint(20) DEFAULT NULL,
  `site_id` int(11) DEFAULT NULL,
  `date_orig` bigint(20) DEFAULT NULL,
  `staff_id` bigint(20) DEFAULT NULL,
  `account_id` bigint(20) DEFAULT NULL,
  `type` varchar(32) DEFAULT NULL,
  `memo` varchar(255) DEFAULT NULL,
  `misc` varchar(32) DEFAULT NULL,
  UNIQUE KEY `IDS` (`site_id`,`id`),
  KEY `account` (`account_id`),
  KEY `memo` (`memo`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_account_oauth`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_account_oauth` (
  `id` bigint(20) NOT NULL,
  `site_id` int(11) NOT NULL,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `account_id` bigint(20) DEFAULT NULL,
  `oauth_id` int(11) NOT NULL,
  `userid` varchar(128) NOT NULL,
  `oauth_data` blob DEFAULT NULL,
  `user_id` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`oauth_id`),
  UNIQUE KEY `UNIQUE` (`site_id`,`account_id`,`oauth_id`),
  UNIQUE KEY `ab_account_oauth_site_id_user_id_oauth_id_unique` (`site_id`,`user_id`,`oauth_id`),
  KEY `fk_ao_o_idx` (`oauth_id`,`site_id`),
  KEY `fk_ao_a_idx` (`account_id`,`site_id`),
  KEY `site_user_id_idx` (`user_id`,`site_id`),
  CONSTRAINT `fk_ao_a` FOREIGN KEY (`account_id`, `site_id`) REFERENCES `accounts` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ao_o` FOREIGN KEY (`oauth_id`, `site_id`) REFERENCES `ab_oauth` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `site_user_id` FOREIGN KEY (`user_id`, `site_id`) REFERENCES `users` (`id`, `site_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_adsl_plan`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_adsl_plan` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `adsl_supplier_plan_id` bigint(20) NOT NULL DEFAULT 0,
  `contract_term` int(11) DEFAULT NULL,
  `base_down_peak` double DEFAULT NULL,
  `base_up_peak` double DEFAULT NULL,
  `base_down_offpeak` double DEFAULT NULL,
  `base_up_offpeak` double DEFAULT NULL,
  `extra_charged` tinyint(4) DEFAULT NULL,
  `extra_shaped` varchar(8) DEFAULT NULL,
  `extra_down_peak` double DEFAULT NULL,
  `extra_up_peak` double DEFAULT NULL,
  `extra_down_offpeak` double DEFAULT NULL,
  `extra_up_offpeak` double DEFAULT NULL,
  `metric` double NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`,`site_id`,`adsl_supplier_plan_id`),
  KEY `fk_ap_asp_idx` (`adsl_supplier_plan_id`,`site_id`),
  CONSTRAINT `fk_ap_asp` FOREIGN KEY (`adsl_supplier_plan_id`, `site_id`) REFERENCES `ab_adsl_supplier_plan` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_adsl_supplier`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_adsl_supplier` (
  `id` int(11) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `active` tinyint(4) DEFAULT NULL,
  `debug` tinyint(4) DEFAULT NULL,
  `name` varchar(128) DEFAULT NULL,
  `notes` varchar(255) DEFAULT NULL,
  `provision_plugin` varchar(128) DEFAULT NULL,
  `provision_plugin_data` longtext DEFAULT NULL,
  `max_accounts` int(11) DEFAULT NULL,
  `stats_url` varchar(256) DEFAULT NULL,
  `stats_lastupdate` date DEFAULT NULL,
  `stats_username` varchar(16) DEFAULT NULL,
  `stats_password` varchar(16) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`),
  KEY `fk_as_set_idx` (`site_id`),
  CONSTRAINT `fk_as_set` FOREIGN KEY (`site_id`) REFERENCES `sites` (`site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_adsl_supplier_plan`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_adsl_supplier_plan` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `supplier_id` int(11) NOT NULL DEFAULT 0,
  `product_id` varchar(16) DEFAULT NULL,
  `product_desc` varchar(128) DEFAULT NULL,
  `base_cost` double DEFAULT NULL,
  `setup_cost` double DEFAULT NULL,
  `contract_term` int(11) DEFAULT NULL,
  `base_down_peak` double DEFAULT NULL,
  `base_up_peak` double DEFAULT NULL,
  `base_down_offpeak` double DEFAULT NULL,
  `base_up_offpeak` double DEFAULT NULL,
  `extra_charged` tinyint(4) DEFAULT NULL,
  `extra_shaped` varchar(8) DEFAULT NULL,
  `offpeak_start` bigint(20) DEFAULT NULL,
  `offpeak_end` bigint(20) DEFAULT NULL,
  `extra_down_peak` double DEFAULT NULL,
  `extra_up_peak` double DEFAULT NULL,
  `extra_down_offpeak` double DEFAULT NULL,
  `extra_up_offpeak` double DEFAULT NULL,
  `metric` double NOT NULL DEFAULT 0,
  `speed` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`supplier_id`),
  KEY `fk_asp_as_idx` (`supplier_id`,`site_id`),
  CONSTRAINT `fk_asp_as` FOREIGN KEY (`supplier_id`, `site_id`) REFERENCES `ab_adsl_supplier` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_affiliate`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_affiliate` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `account_id` bigint(20) NOT NULL DEFAULT 0,
  `avail_campaign_id` longtext DEFAULT NULL,
  `affiliate_plugin` varchar(32) DEFAULT NULL,
  `parent_affiliate_id` varchar(16) DEFAULT NULL,
  `max_tiers` int(11) DEFAULT NULL,
  `commission_minimum` double DEFAULT NULL,
  `new_commission_type` tinyint(4) DEFAULT NULL,
  `new_commission_rate` longtext DEFAULT NULL,
  `recurr_commission_type` tinyint(4) DEFAULT NULL,
  `recurr_commission_rate` longtext DEFAULT NULL,
  `recurr_max_commission_periods` int(11) DEFAULT NULL,
  `plugin_data` longtext DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`account_id`),
  KEY `fk_aff_acc_idx` (`account_id`,`site_id`),
  CONSTRAINT `fk_aff_acc` FOREIGN KEY (`account_id`, `site_id`) REFERENCES `accounts` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_asset`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_asset` (
  `id` bigint(20) DEFAULT NULL,
  `site_id` int(11) DEFAULT NULL,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `service_id` bigint(20) DEFAULT NULL,
  `pool_id` int(11) DEFAULT NULL,
  `asset` varchar(128) DEFAULT NULL,
  `misc` varchar(255) DEFAULT NULL,
  UNIQUE KEY `IDS` (`site_id`,`id`),
  KEY `assets` (`id`,`site_id`),
  KEY `asso` (`pool_id`),
  KEY `service` (`service_id`),
  KEY `asset` (`asset`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_asset_pool`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_asset_pool` (
  `id` int(11) DEFAULT NULL,
  `site_id` int(11) DEFAULT NULL,
  `name` varchar(32) DEFAULT NULL,
  UNIQUE KEY `IDS` (`site_id`,`id`),
  KEY `main` (`id`,`site_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_cart`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_cart` (
  `id` int(11) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `session_id` varchar(32) NOT NULL DEFAULT '',
  `quantity` int(11) DEFAULT NULL,
  `module_id` int(11) NOT NULL DEFAULT 0,
  `module_item` int(11) NOT NULL DEFAULT 0,
  `module_data` text DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`),
  KEY `fk_mod_crt_idx` (`module_id`,`site_id`),
  CONSTRAINT `fk_mod_crt` FOREIGN KEY (`module_id`, `site_id`) REFERENCES `ab_module` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_charge`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_charge` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `processed` tinyint(4) DEFAULT NULL,
  `sweep_type` int(11) DEFAULT NULL,
  `type` int(11) DEFAULT NULL,
  `account_id` bigint(20) NOT NULL DEFAULT 0,
  `product_id` bigint(20) DEFAULT NULL,
  `service_id` bigint(20) DEFAULT NULL,
  `date_charge` bigint(20) DEFAULT NULL,
  `amount` double DEFAULT NULL,
  `quantity` double DEFAULT NULL,
  `taxable` tinyint(4) DEFAULT NULL,
  `attributes` blob DEFAULT NULL,
  `description` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`account_id`),
  KEY `fk_chg_acc_idx` (`account_id`,`site_id`),
  KEY `fk_chg_svc_idx` (`service_id`,`site_id`),
  KEY `fk_chg_pdt_idx` (`product_id`,`site_id`),
  CONSTRAINT `fk_chg_acc` FOREIGN KEY (`account_id`, `site_id`) REFERENCES `accounts` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_chg_pdt` FOREIGN KEY (`product_id`, `site_id`) REFERENCES `ab_product` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_chg_svc` FOREIGN KEY (`service_id`, `site_id`) REFERENCES `ab_service` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_checkout`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_checkout` (
  `id` int(11) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `active` tinyint(4) DEFAULT NULL,
  `name` varchar(32) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `plugin` varchar(32) DEFAULT NULL,
  `plugin_data` longtext DEFAULT NULL,
  `graphic_url` varchar(128) DEFAULT NULL,
  `amount_min` double DEFAULT 0,
  `amount_max` double DEFAULT NULL,
  `fee_fixed` double DEFAULT NULL,
  `fee_variable` double DEFAULT NULL,
  `fee_passon` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`),
  KEY `fk_cko_set_idx` (`site_id`),
  CONSTRAINT `fk_cko_set` FOREIGN KEY (`site_id`) REFERENCES `sites` (`site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_checkout_notify`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_checkout_notify` (
  `id` bigint(20) NOT NULL,
  `site_id` int(11) NOT NULL,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `checkout_id` int(11) NOT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `data` blob NOT NULL,
  `processed` tinyint(4) DEFAULT NULL,
  `result` text DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`checkout_id`),
  KEY `fk_cn_c_idx` (`checkout_id`,`site_id`),
  CONSTRAINT `fk_cn_c` FOREIGN KEY (`checkout_id`, `site_id`) REFERENCES `ab_checkout` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_country`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_country` (
  `id` int(11) NOT NULL DEFAULT 0,
  `name` varchar(128) DEFAULT NULL,
  `description` varchar(128) DEFAULT NULL,
  `notes` varchar(128) DEFAULT NULL,
  `two_code` varchar(16) DEFAULT NULL,
  `three_code` varchar(16) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `currency_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `two_code_UNIQUE` (`two_code`),
  UNIQUE KEY `three_code_UNIQUE` (`three_code`),
  UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_currency`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_currency` (
  `id` int(11) NOT NULL DEFAULT 0,
  `country_id` int(11) DEFAULT NULL,
  `name` varchar(128) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `convert_array` longtext DEFAULT NULL,
  `notes` varchar(128) DEFAULT NULL,
  `symbol` varchar(16) DEFAULT NULL,
  `iso_code` varchar(3) DEFAULT NULL,
  `rounding` smallint(6) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `three_digit_UNIQUE` (`iso_code`),
  KEY `fk_cur_cty_idx` (`country_id`),
  CONSTRAINT `fk_cur_cty` FOREIGN KEY (`country_id`) REFERENCES `ab_country` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_discount`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_discount` (
  `id` bigint(20) DEFAULT NULL,
  `site_id` int(11) DEFAULT NULL,
  `date_orig` bigint(20) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `date_start` bigint(20) DEFAULT NULL,
  `date_expire` bigint(20) DEFAULT NULL,
  `name` varchar(64) DEFAULT NULL,
  `notes` longtext DEFAULT NULL,
  `max_usage_account` int(11) DEFAULT NULL,
  `max_usage_global` int(11) DEFAULT NULL,
  `avail_account_id` bigint(20) DEFAULT NULL,
  `avail_product_id` longtext DEFAULT NULL,
  `avail_group_id` longtext DEFAULT NULL,
  `avail_tld_id` longtext DEFAULT NULL,
  `new_status` tinyint(4) DEFAULT NULL,
  `new_type` tinyint(4) DEFAULT NULL,
  `new_rate` double DEFAULT NULL,
  `new_max_discount` double DEFAULT NULL,
  `new_min_cost` double DEFAULT NULL,
  `recurr_status` tinyint(4) DEFAULT NULL,
  `recurr_type` tinyint(4) DEFAULT NULL,
  `recurr_rate` double DEFAULT NULL,
  `recurr_max_discount` double DEFAULT NULL,
  `recurr_min_cost` double DEFAULT NULL,
  UNIQUE KEY `IDS` (`site_id`,`id`),
  KEY `start` (`date_start`),
  KEY `expire` (`date_expire`),
  KEY `status` (`active`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_domain_registrar`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_domain_registrar` (
  `id` int(11) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `active` tinyint(4) DEFAULT NULL,
  `name` varchar(32) DEFAULT NULL,
  `file` varchar(32) DEFAULT NULL,
  `whitelabel_url` varchar(256) DEFAULT NULL,
  `whitelabel_ns` varchar(1024) DEFAULT NULL,
  `manage_url` varchar(256) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`),
  UNIQUE KEY `IDS` (`site_id`,`id`),
  KEY `fk_hrp_set` (`site_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_domain_tld`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_domain_tld` (
  `id` int(11) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `name` varchar(128) DEFAULT NULL,
  `taxable` tinyint(4) DEFAULT NULL,
  `whois_plugin` varchar(32) DEFAULT NULL,
  `whois_plugin_data` longtext DEFAULT NULL,
  `registrar_plugin_id` int(11) NOT NULL DEFAULT 0,
  `registrar_plugin_data` longtext DEFAULT NULL,
  `auto_search` tinyint(4) DEFAULT NULL,
  `default_term_new` int(11) DEFAULT NULL,
  `price_group` longtext DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`registrar_plugin_id`),
  KEY `fk_ht_hrp_idx` (`registrar_plugin_id`,`site_id`),
  CONSTRAINT `fk_ht_hrp` FOREIGN KEY (`registrar_plugin_id`, `site_id`) REFERENCES `ab_domain_registrar` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_email_log`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_email_log` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `account_id` bigint(20) NOT NULL DEFAULT 0,
  `email_template_translate_id` bigint(20) DEFAULT NULL,
  `email` varchar(128) DEFAULT NULL,
  `subject` varchar(128) DEFAULT NULL,
  `message` longtext DEFAULT NULL,
  `html` tinyint(4) DEFAULT NULL,
  `urgent` tinyint(4) DEFAULT NULL,
  `userread` tinyint(4) DEFAULT NULL,
  `data` blob DEFAULT NULL,
  `module_id` int(11) DEFAULT NULL,
  `module_data` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`account_id`),
  KEY `fk_el_ett_idx` (`email_template_translate_id`,`site_id`),
  KEY `fk_el_acc_idx` (`account_id`,`site_id`),
  KEY `fk_el_mod_idx` (`module_id`,`site_id`),
  CONSTRAINT `fk_el_acc` FOREIGN KEY (`account_id`, `site_id`) REFERENCES `accounts` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_el_ett` FOREIGN KEY (`email_template_translate_id`, `site_id`) REFERENCES `ab_email_template_translate` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_el_mod` FOREIGN KEY (`module_id`, `site_id`) REFERENCES `ab_module` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_email_setup`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_email_setup` (
  `id` int(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `account_id` bigint(20) NOT NULL DEFAULT 0,
  `name` varchar(128) DEFAULT NULL,
  `notes` longtext DEFAULT NULL,
  `type` tinyint(4) DEFAULT NULL,
  `from_name` varchar(128) DEFAULT NULL,
  `from_email` varchar(128) DEFAULT NULL,
  `cc_list` longtext DEFAULT NULL,
  `bcc_list` longtext DEFAULT NULL,
  `server` varchar(128) DEFAULT NULL,
  `username` varchar(128) DEFAULT NULL,
  `password` varchar(128) DEFAULT NULL,
  `piping` varchar(4) DEFAULT NULL,
  `piping_host` varchar(128) DEFAULT NULL,
  `piping_username` varchar(128) DEFAULT NULL,
  `piping_password` varchar(128) DEFAULT NULL,
  `piping_action` varchar(4) DEFAULT NULL,
  `queue` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`account_id`),
  KEY `fk_es_acc_idx` (`account_id`,`site_id`),
  CONSTRAINT `fk_es_acc` FOREIGN KEY (`account_id`, `site_id`) REFERENCES `accounts` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_email_template`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_email_template` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `active` tinyint(4) DEFAULT NULL,
  `email_setup_id` int(11) NOT NULL DEFAULT 0,
  `name` varchar(128) DEFAULT NULL,
  `description` varchar(32) DEFAULT NULL,
  `notes` longtext DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`email_setup_id`),
  KEY `fk_et_es_idx` (`email_setup_id`,`site_id`),
  CONSTRAINT `fk_et_es` FOREIGN KEY (`email_setup_id`, `site_id`) REFERENCES `ab_email_setup` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_email_template_translate`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_email_template_translate` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `email_template_id` bigint(20) NOT NULL DEFAULT 0,
  `language_id` int(11) NOT NULL DEFAULT 0,
  `subject` varchar(255) NOT NULL,
  `message_text` longtext NOT NULL,
  `message_html` longtext DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`email_template_id`,`language_id`),
  KEY `fk_emt_et_idx` (`email_template_id`,`site_id`),
  KEY `fk_emt_lan_idx` (`language_id`),
  CONSTRAINT `fk_emt_et` FOREIGN KEY (`email_template_id`, `site_id`) REFERENCES `ab_email_template` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_emt_lan` FOREIGN KEY (`language_id`) REFERENCES `ab_language` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_export`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_export` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `name` varchar(128) NOT NULL DEFAULT '',
  `plugin` varchar(128) NOT NULL DEFAULT '',
  `active` tinyint(4) DEFAULT NULL,
  `url` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`),
  UNIQUE KEY `UNIQUE` (`site_id`,`name`),
  KEY `fk_exp_set_idx` (`site_id`),
  CONSTRAINT `fk_exp_set` FOREIGN KEY (`site_id`) REFERENCES `sites` (`site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_export_datamap`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_export_datamap` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `export_module_id` bigint(20) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `item_id` bigint(20) DEFAULT NULL,
  `module_id` int(11) NOT NULL,
  `map_data` blob DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`export_module_id`,`module_id`),
  UNIQUE KEY `UNIQUE` (`item_id`,`export_module_id`,`site_id`),
  KEY `fk_edm_mod_idx` (`export_module_id`,`site_id`),
  KEY `fk_edm_mod_idx1` (`module_id`,`site_id`),
  CONSTRAINT `fk_edm_exm` FOREIGN KEY (`export_module_id`, `site_id`) REFERENCES `ab_export_module` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_edm_mod` FOREIGN KEY (`module_id`, `site_id`) REFERENCES `ab_module` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_export_item`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_export_item` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `export_module_id` bigint(20) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `item_id` bigint(20) NOT NULL DEFAULT 0,
  `reference` varchar(64) DEFAULT NULL,
  `crc` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`export_module_id`),
  UNIQUE KEY `UNIQUE` (`site_id`,`export_module_id`,`item_id`),
  KEY `fk_exp_eit_idx` (`export_module_id`,`site_id`),
  CONSTRAINT `fk_eit_exm` FOREIGN KEY (`export_module_id`, `site_id`) REFERENCES `ab_export_module` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_export_module`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_export_module` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `export_id` bigint(20) NOT NULL DEFAULT 0,
  `module_id` int(11) NOT NULL DEFAULT 0,
  `display` blob DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`export_id`,`module_id`),
  KEY `fk_exp_exm_idx` (`export_id`,`site_id`),
  KEY `fk_exp_mod_idx` (`module_id`,`site_id`),
  CONSTRAINT `fk_exm_exp` FOREIGN KEY (`export_id`, `site_id`) REFERENCES `ab_export` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_exm_mod` FOREIGN KEY (`module_id`, `site_id`) REFERENCES `ab_module` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_group`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_group` (
  `id` int(11) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_start` bigint(20) DEFAULT NULL,
  `date_expire` bigint(20) DEFAULT NULL,
  `parent_id` int(11) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `pricing` tinyint(4) DEFAULT NULL,
  `name` varchar(128) DEFAULT NULL,
  `notes` longtext DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`),
  KEY `fk_grp_set_idx` (`site_id`),
  CONSTRAINT `fk_grp_set` FOREIGN KEY (`site_id`) REFERENCES `sites` (`site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_group_method`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_group_method` (
  `id` int(11) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `method_id` int(11) NOT NULL DEFAULT 0,
  `group_id` int(11) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`,`site_id`,`method_id`,`group_id`),
  UNIQUE KEY `UNIQUE` (`id`,`site_id`),
  KEY `fk_gm_mm_idx` (`method_id`,`site_id`),
  KEY `fk_gm_grp_idx` (`group_id`,`site_id`),
  CONSTRAINT `fk_gm_grp` FOREIGN KEY (`group_id`, `site_id`) REFERENCES `ab_group` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_gm_mm` FOREIGN KEY (`method_id`, `site_id`) REFERENCES `ab_module_method` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_host_server`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_host_server` (
  `id` int(11) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `active` tinyint(4) DEFAULT NULL,
  `debug` tinyint(4) DEFAULT NULL,
  `name` varchar(128) DEFAULT NULL,
  `notes` varchar(255) DEFAULT NULL,
  `provision_plugin` varchar(128) DEFAULT NULL,
  `provision_plugin_data` longtext DEFAULT NULL,
  `max_accounts` int(11) DEFAULT NULL,
  `whitelabel_url` varchar(256) DEFAULT NULL,
  `manage_url` varchar(256) DEFAULT NULL,
  `manage_username` varchar(45) DEFAULT NULL,
  `manage_password` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`),
  UNIQUE KEY `IDS` (`site_id`,`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_host_server_affiliate`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_host_server_affiliate` (
  `id` bigint(20) NOT NULL,
  `site_id` int(11) NOT NULL,
  `affiliate_id` bigint(20) NOT NULL,
  `host_server_id` int(11) NOT NULL,
  `host_username` varchar(45) DEFAULT NULL,
  `host_password` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`affiliate_id`,`host_server_id`),
  KEY `fk_hsa_aff_idx` (`affiliate_id`,`site_id`),
  KEY `fk_hsa_hs_idx` (`host_server_id`,`site_id`),
  CONSTRAINT `fk_hsa_aff` FOREIGN KEY (`affiliate_id`, `site_id`) REFERENCES `ab_affiliate` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_hsa_hs` FOREIGN KEY (`host_server_id`, `site_id`) REFERENCES `ab_host_server` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_host_server_id`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_host_server_id` (
  `id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_host_tld_id`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_host_tld_id` (
  `id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_import`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_import` (
  `id` bigint(20) DEFAULT NULL,
  `site_id` int(11) DEFAULT NULL,
  `date_orig` bigint(20) DEFAULT NULL,
  `plugin` varchar(32) DEFAULT NULL,
  `action` varchar(32) DEFAULT NULL,
  `remote_table` varchar(32) DEFAULT NULL,
  `ab_table` varchar(32) DEFAULT NULL,
  `remote_id` bigint(20) DEFAULT NULL,
  `ab_id` bigint(20) DEFAULT NULL,
  UNIQUE KEY `IDS` (`site_id`,`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_invoice`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_invoice` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `process_status` tinyint(4) DEFAULT NULL,
  `billing_status` tinyint(4) DEFAULT NULL,
  `print_status` tinyint(4) DEFAULT NULL,
  `account_id` bigint(20) NOT NULL DEFAULT 0,
  `account_billing_id` int(11) DEFAULT NULL,
  `discount_amt` double DEFAULT NULL,
  `due_date` bigint(20) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `reminders` blob DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`account_id`),
  KEY `fk_inv_acc_idx` (`account_id`,`site_id`),
  CONSTRAINT `fk_inv_acc` FOREIGN KEY (`account_id`, `site_id`) REFERENCES `accounts` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_invoice_item`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_invoice_item` (
  `id` bigint(20) NOT NULL,
  `site_id` int(11) NOT NULL,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `service_id` bigint(20) DEFAULT NULL,
  `invoice_id` bigint(20) NOT NULL,
  `active` tinyint(1) DEFAULT NULL,
  `product_id` bigint(20) DEFAULT NULL,
  `module_id` int(11) DEFAULT NULL,
  `module_ref` bigint(20) DEFAULT NULL,
  `quantity` double DEFAULT NULL,
  `item_type` tinyint(4) DEFAULT NULL,
  `product_name` varchar(128) DEFAULT NULL,
  `discount_amt` double DEFAULT NULL,
  `price_base` double DEFAULT NULL,
  `recurring_schedule` int(11) DEFAULT NULL,
  `date_start` bigint(20) DEFAULT NULL,
  `date_stop` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`invoice_id`),
  UNIQUE KEY `UNIQUE` (`id`,`site_id`),
  KEY `fk_ii_inv_idx` (`invoice_id`,`site_id`),
  KEY `fk_ii_pdt_idx` (`product_id`,`site_id`),
  KEY `fk_ii_svc_idx` (`service_id`,`site_id`),
  KEY `fk_ii_mod_idx` (`module_id`,`site_id`),
  CONSTRAINT `fk_ii_inv` FOREIGN KEY (`invoice_id`, `site_id`) REFERENCES `ab_invoice` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ii_mod` FOREIGN KEY (`module_id`, `site_id`) REFERENCES `ab_module` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ii_pdt` FOREIGN KEY (`product_id`, `site_id`) REFERENCES `ab_product` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ii_svc` FOREIGN KEY (`service_id`, `site_id`) REFERENCES `ab_service` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_invoice_item_discount`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_invoice_item_discount` (
  `id` int(11) DEFAULT NULL,
  `site_id` int(11) DEFAULT NULL,
  `date_orig` bigint(20) DEFAULT NULL,
  `invoice_id` bigint(20) DEFAULT NULL,
  `account_id` bigint(20) DEFAULT NULL,
  `invoice_item_id` bigint(20) DEFAULT NULL,
  `discount` varchar(64) DEFAULT NULL,
  `amount` double DEFAULT NULL,
  UNIQUE KEY `IDS` (`site_id`,`id`),
  KEY `discounts` (`discount`),
  KEY `invoice_id` (`invoice_id`,`invoice_item_id`),
  KEY `dates` (`date_orig`),
  KEY `accounts` (`account_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_invoice_item_tax`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_invoice_item_tax` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `invoice_item_id` bigint(20) NOT NULL DEFAULT 0,
  `tax_id` int(11) NOT NULL DEFAULT 0,
  `amount` double NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`,`site_id`,`invoice_item_id`,`tax_id`),
  KEY `fk_iit_ii_idx` (`invoice_item_id`,`site_id`),
  KEY `fk_iit_tax_idx` (`tax_id`),
  CONSTRAINT `fk_iit_ii` FOREIGN KEY (`invoice_item_id`, `site_id`) REFERENCES `ab_invoice_item` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_iit_tax` FOREIGN KEY (`tax_id`) REFERENCES `ab_tax` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_invoice_memo`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_invoice_memo` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `invoice_id` bigint(20) NOT NULL DEFAULT 0,
  `account_id` bigint(20) DEFAULT NULL,
  `type` varchar(32) DEFAULT NULL,
  `memo` blob DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`invoice_id`),
  KEY `fk_im_inv_idx` (`invoice_id`,`site_id`),
  KEY `fk_im_acc_idx` (`account_id`,`site_id`),
  CONSTRAINT `fk_im_acc` FOREIGN KEY (`account_id`, `site_id`) REFERENCES `accounts` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_im_inv` FOREIGN KEY (`invoice_id`, `site_id`) REFERENCES `ab_invoice` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_language`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_language` (
  `id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `iso` varchar(5) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name_UNIQUE` (`name`),
  UNIQUE KEY `iso_UNIQUE` (`iso`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_log_error`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_log_error` (
  `id` bigint(20) DEFAULT NULL,
  `site_id` int(11) DEFAULT NULL,
  `date_orig` bigint(20) DEFAULT NULL,
  `account_id` bigint(20) DEFAULT NULL,
  `module` varchar(64) DEFAULT NULL,
  `method` varchar(64) DEFAULT NULL,
  `message` longtext DEFAULT NULL,
  UNIQUE KEY `IDS` (`site_id`,`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_module`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_module` (
  `id` int(11) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `name` varchar(128) NOT NULL DEFAULT '',
  `date_orig` bigint(20) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `parent_id` int(11) DEFAULT NULL,
  `notes` longtext DEFAULT NULL,
  `external` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`),
  UNIQUE KEY `UNIQUE` (`site_id`,`name`),
  KEY `fk_mod_set_idx` (`site_id`),
  KEY `fk_mod_idx` (`parent_id`,`site_id`),
  CONSTRAINT `fk_mod` FOREIGN KEY (`parent_id`, `site_id`) REFERENCES `ab_module` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_mod_set` FOREIGN KEY (`site_id`) REFERENCES `sites` (`site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_module_method`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_module_method` (
  `id` int(11) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `module_id` int(11) NOT NULL DEFAULT 0,
  `name` varchar(64) DEFAULT '',
  `notes` varchar(128) DEFAULT NULL,
  `menu_display` varchar(32) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`module_id`),
  UNIQUE KEY `UNIQUE` (`id`,`site_id`),
  UNIQUE KEY `UNIQUE2` (`site_id`,`module_id`,`name`),
  KEY `fk_mm_mod_idx` (`module_id`,`site_id`),
  CONSTRAINT `fk_mm_mod` FOREIGN KEY (`module_id`, `site_id`) REFERENCES `ab_module` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_module_method_token`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_module_method_token` (
  `id` int(11) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `method_id` int(11) NOT NULL DEFAULT 0,
  `account_id` bigint(20) NOT NULL DEFAULT 0,
  `token` varchar(36) NOT NULL DEFAULT '',
  `date_orig` bigint(20) NOT NULL DEFAULT 0,
  `date_last` bigint(20) DEFAULT NULL,
  `date_expire` bigint(20) DEFAULT NULL,
  `uses` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`method_id`,`account_id`),
  KEY `fk_mmt_mm_idx` (`method_id`,`site_id`),
  KEY `fk_mmt_acc_idx` (`account_id`,`site_id`),
  CONSTRAINT `fk_mmt_acc` FOREIGN KEY (`account_id`, `site_id`) REFERENCES `accounts` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_mmt_mm` FOREIGN KEY (`method_id`, `site_id`) REFERENCES `ab_module_method` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_oauth`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_oauth` (
  `id` int(11) NOT NULL,
  `site_id` int(11) NOT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `name` varchar(32) NOT NULL,
  `app_id` varchar(128) DEFAULT NULL,
  `secret` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`),
  UNIQUE KEY `ab_oauth_site_id_name_unique` (`site_id`,`name`),
  KEY `fk_o_set_idx` (`site_id`),
  CONSTRAINT `fk_o_set` FOREIGN KEY (`site_id`) REFERENCES `sites` (`site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_payment`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_payment` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `account_id` bigint(20) NOT NULL DEFAULT 0,
  `date_payment` bigint(20) DEFAULT NULL,
  `checkout_id` int(11) NOT NULL DEFAULT 0,
  `checkout_data` varchar(255) DEFAULT NULL,
  `total_amt` double DEFAULT NULL,
  `fees_amt` double DEFAULT NULL,
  `source_id` bigint(20) DEFAULT NULL,
  `pending_status` tinyint(4) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `ip` varchar(32) DEFAULT NULL,
  `pending` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`,`checkout_id`,`account_id`,`site_id`),
  UNIQUE KEY `UNIQUE` (`id`,`site_id`),
  KEY `fk_pay_acc_idx` (`account_id`,`site_id`),
  KEY `fk_pay_cp_idx` (`checkout_id`,`site_id`),
  KEY `fk_pay_acc_b_idx` (`source_id`,`site_id`),
  CONSTRAINT `fk_pay_acc` FOREIGN KEY (`account_id`, `site_id`) REFERENCES `accounts` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_pay_acc_b` FOREIGN KEY (`source_id`, `site_id`) REFERENCES `accounts` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_pay_co` FOREIGN KEY (`checkout_id`, `site_id`) REFERENCES `ab_checkout` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_payment_item`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_payment_item` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `payment_id` bigint(20) NOT NULL DEFAULT 0,
  `invoice_id` bigint(20) DEFAULT NULL,
  `alloc_amt` double DEFAULT NULL,
  PRIMARY KEY (`id`,`payment_id`,`site_id`),
  UNIQUE KEY `UNIQUE` (`id`,`site_id`),
  KEY `fk_pi_pay_idx` (`payment_id`,`site_id`),
  KEY `fk_pi_inv_idx` (`invoice_id`,`site_id`),
  CONSTRAINT `fk_pi_inv` FOREIGN KEY (`invoice_id`, `site_id`) REFERENCES `ab_invoice` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_pi_pay` FOREIGN KEY (`payment_id`, `site_id`) REFERENCES `ab_payment` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_pivot_product_cat`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_pivot_product_cat` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `site_id` int(11) NOT NULL,
  `product_id` bigint(20) DEFAULT NULL,
  `product_cat_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`),
  UNIQUE KEY `UNIQUE` (`site_id`,`product_id`,`product_cat_id`),
  KEY `fk_pc_idx` (`product_cat_id`,`site_id`),
  KEY `fk_p_idx` (`product_id`,`site_id`),
  CONSTRAINT `fk_p` FOREIGN KEY (`product_id`, `site_id`) REFERENCES `ab_product` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_pc` FOREIGN KEY (`product_cat_id`, `site_id`) REFERENCES `ab_product_cat` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_product`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_product` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `taxable` tinyint(4) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `position` tinyint(4) DEFAULT NULL,
  `cart_multiple` tinyint(4) DEFAULT NULL,
  `group_avail` blob DEFAULT NULL,
  `avail_category` blob DEFAULT NULL,
  `price_type` tinyint(4) DEFAULT NULL,
  `price_group` blob DEFAULT NULL,
  `price_recurr_default` tinyint(4) DEFAULT NULL,
  `price_recurr_day` tinyint(4) DEFAULT NULL,
  `price_recurr_weekday` tinyint(4) DEFAULT NULL,
  `price_recurr_strict` tinyint(4) DEFAULT NULL,
  `prod_plugin_file` varchar(128) DEFAULT NULL,
  `prod_plugin_data` blob DEFAULT NULL,
  `accounting` varchar(64) DEFAULT NULL,
  `model` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`),
  KEY `fk_pdt_set_idx` (`site_id`),
  CONSTRAINT `fk_pdt_set` FOREIGN KEY (`site_id`) REFERENCES `sites` (`site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_product_cat`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_product_cat` (
  `id` int(11) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `parent_id` int(11) DEFAULT NULL,
  `group_avail` blob DEFAULT NULL,
  `notes` blob DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `template` varchar(128) DEFAULT NULL,
  `position` int(11) DEFAULT NULL,
  `recur_schedule` int(11) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`,`site_id`),
  KEY `fk_pc_set_idx` (`site_id`),
  KEY `fk_pc_pc_idx` (`parent_id`),
  CONSTRAINT `fk_pc_pc` FOREIGN KEY (`parent_id`) REFERENCES `ab_product_cat` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_pc_set` FOREIGN KEY (`site_id`) REFERENCES `sites` (`site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_product_cat_translate`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_product_cat_translate` (
  `id` int(11) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `product_cat_id` int(11) NOT NULL DEFAULT 0,
  `language_id` int(11) NOT NULL DEFAULT 0,
  `name` varchar(128) DEFAULT NULL,
  `description` blob DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`product_cat_id`,`language_id`),
  UNIQUE KEY `UNIQUE` (`site_id`,`product_cat_id`,`language_id`),
  KEY `fk_pct_pc_idx` (`product_cat_id`,`site_id`),
  KEY `fk_pct_lan_idx` (`language_id`),
  CONSTRAINT `fk_pct_lan` FOREIGN KEY (`language_id`) REFERENCES `ab_language` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_pct_pc` FOREIGN KEY (`product_cat_id`, `site_id`) REFERENCES `ab_product_cat` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_product_translate`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_product_translate` (
  `id` int(11) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `product_id` bigint(20) NOT NULL DEFAULT 0,
  `language_id` int(11) NOT NULL DEFAULT 0,
  `name` varchar(128) DEFAULT NULL,
  `description_short` longtext DEFAULT NULL,
  `description_full` blob DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`product_id`,`language_id`),
  UNIQUE KEY `UNIQUE` (`product_id`,`language_id`,`site_id`),
  KEY `fk_pt_p_idx` (`site_id`,`product_id`),
  KEY `fk_pt_l_idx` (`language_id`),
  CONSTRAINT `fk_pt_l` FOREIGN KEY (`language_id`) REFERENCES `ab_language` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_pt_p` FOREIGN KEY (`site_id`, `product_id`) REFERENCES `ab_product` (`site_id`, `id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_record_id`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_record_id` (
  `site_id` int(11) NOT NULL DEFAULT 0,
  `module_id` int(11) NOT NULL DEFAULT 0,
  `id` int(11) NOT NULL DEFAULT 0,
  PRIMARY KEY (`site_id`,`module_id`),
  KEY `fk_rid_set_idx` (`site_id`),
  KEY `fk_rid_mod_idx` (`module_id`,`site_id`),
  CONSTRAINT `fk_rid_mod` FOREIGN KEY (`module_id`, `site_id`) REFERENCES `ab_module` (`id`, `site_id`),
  CONSTRAINT `fk_rid_set` FOREIGN KEY (`site_id`) REFERENCES `sites` (`site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_rtm`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_rtm` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `account_id` bigint(20) NOT NULL DEFAULT 0,
  `name` varchar(64) NOT NULL DEFAULT '',
  `parent_id` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`account_id`),
  UNIQUE KEY `uq_name` (`name`),
  KEY `fk_rtm_set_idx` (`account_id`,`site_id`),
  KEY `fk_rtm_acc_p_idx` (`parent_id`),
  CONSTRAINT `fk_rtm_acc` FOREIGN KEY (`account_id`, `site_id`) REFERENCES `accounts` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_rtm_rtm` FOREIGN KEY (`parent_id`) REFERENCES `ab_rtm` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_service`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_service` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `account_id` bigint(20) NOT NULL DEFAULT 0,
  `account_billing_id` bigint(20) DEFAULT NULL,
  `product_id` bigint(20) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `suspend_billing` tinyint(4) DEFAULT NULL,
  `external_billing` tinyint(4) DEFAULT NULL,
  `price` double DEFAULT NULL,
  `price_group` int(11) NOT NULL DEFAULT 0,
  `price_override` double DEFAULT NULL,
  `taxable` tinyint(4) DEFAULT NULL,
  `queue` varchar(16) DEFAULT NULL,
  `date_last_invoice` bigint(20) DEFAULT NULL,
  `date_next_invoice` bigint(20) DEFAULT NULL,
  `recur_schedule` int(11) DEFAULT NULL,
  `prod_attr` longtext DEFAULT NULL,
  `date_start` bigint(20) DEFAULT NULL,
  `date_end` bigint(20) DEFAULT NULL,
  `orderby_id` int(10) unsigned DEFAULT NULL,
  `order_status` varchar(191) DEFAULT NULL,
  `order_info` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `model` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`price_group`),
  UNIQUE KEY `UNIQUE` (`site_id`,`id`,`account_id`),
  KEY `fk_svc_acc_idx` (`account_id`,`site_id`),
  KEY `fk_svc_grp_idx` (`site_id`,`price_group`),
  KEY `ab_service_orderby_id_foreign` (`orderby_id`),
  CONSTRAINT `ab_service_orderby_id_foreign` FOREIGN KEY (`orderby_id`) REFERENCES `users` (`id`),
  CONSTRAINT `fk_svc_acc` FOREIGN KEY (`account_id`, `site_id`) REFERENCES `accounts` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_svc_grp` FOREIGN KEY (`site_id`, `price_group`) REFERENCES `ab_group` (`site_id`, `id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_service__adsl`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_service__adsl` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `service_id` bigint(20) NOT NULL DEFAULT 0,
  `provided_adsl_plan_id` bigint(20) DEFAULT NULL,
  `service_number` varchar(10) DEFAULT NULL,
  `service_address` varchar(128) DEFAULT NULL,
  `contract_term` int(11) DEFAULT NULL,
  `service_connect_date` bigint(20) DEFAULT NULL,
  `service_contract_date` bigint(20) DEFAULT NULL,
  `service_username` varchar(128) DEFAULT NULL,
  `service_password` varchar(16) DEFAULT NULL,
  `service_stats_collect` tinyint(4) DEFAULT NULL,
  `service_stats_lastupdate` date DEFAULT NULL,
  `ipaddress` varchar(45) DEFAULT NULL,
  `offpeak_start` time DEFAULT NULL,
  `offpeak_end` time DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`service_id`),
  UNIQUE KEY `UNIQUE` (`id`,`site_id`),
  UNIQUE KEY `uq_service_username` (`service_username`),
  KEY `fk_service_number` (`service_number`),
  KEY `fk_sa_svc_idx` (`service_id`,`site_id`),
  KEY `fk_sa_ap_idx` (`provided_adsl_plan_id`,`site_id`),
  CONSTRAINT `fk_sa_ap` FOREIGN KEY (`provided_adsl_plan_id`, `site_id`) REFERENCES `ab_adsl_plan` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_sa_svc` FOREIGN KEY (`service_id`, `site_id`) REFERENCES `ab_service` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_service__adsl_traffic`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_service__adsl_traffic` (
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date` date NOT NULL,
  `service` varchar(128) DEFAULT NULL,
  `supplier_id` int(11) NOT NULL,
  `up_peak` int(11) DEFAULT NULL,
  `up_offpeak` int(11) DEFAULT NULL,
  `down_peak` int(11) DEFAULT NULL,
  `down_offpeak` int(11) DEFAULT NULL,
  `peer` int(11) DEFAULT NULL,
  `internal` int(11) DEFAULT NULL,
  `time` time DEFAULT NULL,
  `ab_service_adsl_id` bigint(20) DEFAULT NULL,
  UNIQUE KEY `ab_service__adsl_traffic_ab_service_adsl_id_date_time_unique` (`ab_service_adsl_id`,`date`,`time`),
  KEY `in_sat_SERVICE` (`service`),
  KEY `in_sat_DATE` (`date`),
  KEY `in_sat_SERVICE_DATE` (`service`,`date`),
  KEY `fk_sat_as_idx` (`supplier_id`,`site_id`),
  CONSTRAINT `ab_service__adsl_traffic_ab_service_adsl_id_foreign` FOREIGN KEY (`ab_service_adsl_id`) REFERENCES `ab_service__adsl` (`id`),
  CONSTRAINT `fk_sat_as` FOREIGN KEY (`supplier_id`, `site_id`) REFERENCES `ab_adsl_supplier` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_service__domain`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_service__domain` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `service_id` bigint(20) NOT NULL DEFAULT 0,
  `domain_tld_id` int(11) NOT NULL DEFAULT 0,
  `domain_registrar_id` int(11) NOT NULL DEFAULT 0,
  `domain_name` varchar(128) DEFAULT NULL,
  `domain_expire` bigint(20) DEFAULT NULL,
  `registrar_type` varchar(16) DEFAULT NULL,
  `registrar_username` varchar(128) DEFAULT NULL,
  `registrar_password` varchar(128) DEFAULT NULL,
  `registrar_auth_password` varchar(128) DEFAULT NULL,
  `registrar_pending_transfer` varchar(16) DEFAULT NULL,
  `registrar_ns` varchar(1024) DEFAULT NULL,
  `registrar_lastsync` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`service_id`,`domain_tld_id`,`domain_registrar_id`),
  UNIQUE KEY `UNIQUE` (`id`,`site_id`),
  KEY `fk_sd_svc_idx` (`service_id`,`site_id`),
  KEY `fk_sd_hrp_idx` (`domain_registrar_id`,`site_id`),
  KEY `fk_sd_ht_idx` (`domain_tld_id`,`site_id`),
  CONSTRAINT `fk_sd_hrp` FOREIGN KEY (`domain_registrar_id`, `site_id`) REFERENCES `ab_domain_registrar` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_sd_ht` FOREIGN KEY (`domain_tld_id`, `site_id`) REFERENCES `ab_domain_tld` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_sd_svc` FOREIGN KEY (`service_id`, `site_id`) REFERENCES `ab_service` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Contain Service Information for HOST_TLD records';
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_service__hosting`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_service__hosting` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `service_id` bigint(20) NOT NULL DEFAULT 0,
  `domain_tld_id` int(11) NOT NULL DEFAULT 0,
  `host_server_id` int(11) NOT NULL DEFAULT 0,
  `domain_name` varchar(128) DEFAULT NULL,
  `host_expire` bigint(20) DEFAULT NULL,
  `host_type` varchar(16) DEFAULT NULL,
  `host_username` varchar(45) DEFAULT NULL,
  `host_password` varchar(45) DEFAULT NULL,
  `ftp_username` varchar(16) DEFAULT NULL,
  `ftp_password` varchar(16) DEFAULT NULL,
  `server_data` blob DEFAULT NULL,
  `server_data_date` text DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`service_id`,`domain_tld_id`,`host_server_id`),
  UNIQUE KEY `UNIQUE` (`id`,`site_id`),
  UNIQUE KEY `uq_ftp_username` (`host_server_id`,`ftp_username`),
  KEY `fk_service_id` (`service_id`,`site_id`),
  KEY `fk_domain_tld_id` (`domain_tld_id`,`site_id`),
  KEY `fk_sh_hs_idx` (`host_server_id`,`site_id`),
  CONSTRAINT `fk_sh_hs` FOREIGN KEY (`host_server_id`, `site_id`) REFERENCES `ab_host_server` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_sh_ht` FOREIGN KEY (`domain_tld_id`, `site_id`) REFERENCES `ab_domain_tld` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_sh_svc` FOREIGN KEY (`service_id`, `site_id`) REFERENCES `ab_service` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_service__ssl`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_service__ssl` (
  `id` bigint(20) NOT NULL,
  `site_id` int(11) NOT NULL,
  `service_id` bigint(20) NOT NULL,
  `ssl_ca_id` bigint(20) DEFAULT NULL,
  `csr` text NOT NULL,
  `pk` text DEFAULT NULL,
  `cert` text DEFAULT NULL,
  PRIMARY KEY (`id`,`service_id`,`site_id`),
  UNIQUE KEY `UNIQUE` (`id`,`site_id`),
  KEY `fk_ss_svc_idx` (`service_id`,`site_id`),
  KEY `fk_ss_sca_idx` (`ssl_ca_id`,`site_id`),
  CONSTRAINT `fk_ss_sca` FOREIGN KEY (`ssl_ca_id`, `site_id`) REFERENCES `ab_ssl_ca` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ss_svc` FOREIGN KEY (`service_id`, `site_id`) REFERENCES `ab_service` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_service__voip`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_service__voip` (
  `id` bigint(20) DEFAULT NULL,
  `site_id` int(11) DEFAULT NULL,
  `service_id` bigint(20) DEFAULT NULL,
  `service_number` varchar(10) DEFAULT NULL,
  `service_address` varchar(128) DEFAULT NULL,
  `contract_term` int(11) DEFAULT NULL,
  `service_connect_date` bigint(20) DEFAULT NULL,
  `service_contract_date` bigint(20) DEFAULT NULL,
  `service_username` varchar(128) DEFAULT NULL,
  `service_password` varchar(32) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_service_change`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_service_change` (
  `id` bigint(20) NOT NULL,
  `site_id` int(11) NOT NULL,
  `service_id` bigint(20) NOT NULL,
  `product_id` bigint(20) NOT NULL,
  `ordered_by` bigint(20) NOT NULL,
  `date_ordered` bigint(20) DEFAULT NULL,
  `date_effective` bigint(20) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `complete` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`service_id`,`product_id`,`ordered_by`),
  KEY `fk_s_sc_idx` (`site_id`,`id`),
  KEY `fk_s_p_idx` (`site_id`,`product_id`),
  KEY `fk_sc_a_idx` (`site_id`,`ordered_by`),
  CONSTRAINT `fk_sc_a` FOREIGN KEY (`site_id`, `ordered_by`) REFERENCES `accounts` (`site_id`, `id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_sc_p` FOREIGN KEY (`site_id`, `product_id`) REFERENCES `ab_product` (`site_id`, `id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_sc_s` FOREIGN KEY (`site_id`, `id`) REFERENCES `ab_service` (`site_id`, `id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_service_memo`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_service_memo` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `service_id` bigint(20) NOT NULL DEFAULT 0,
  `account_id` bigint(20) DEFAULT NULL,
  `type` varchar(32) DEFAULT NULL,
  `memo` blob DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`service_id`),
  KEY `fk_sm_svc_idx` (`service_id`,`site_id`),
  KEY `fk_sm_acc_idx` (`account_id`,`site_id`),
  CONSTRAINT `fk_sm_acc` FOREIGN KEY (`account_id`, `site_id`) REFERENCES `accounts` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_sm_svc` FOREIGN KEY (`service_id`, `site_id`) REFERENCES `ab_service` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_setup_invoice`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_setup_invoice` (
  `id` int(11) DEFAULT NULL,
  `site_id` int(11) DEFAULT NULL,
  `bill_to_company` tinyint(4) DEFAULT NULL,
  `invoice_currency` varchar(8) DEFAULT NULL,
  `invoice_decimals` int(11) DEFAULT NULL,
  `items_summary_max` int(11) DEFAULT NULL,
  `news` text DEFAULT NULL,
  `page_type` varchar(8) DEFAULT NULL,
  `invoice_delivery` int(11) DEFAULT NULL,
  `invoice_show_itemized` tinyint(4) DEFAULT NULL,
  `invoice_show_service_dates` tinyint(4) DEFAULT NULL,
  `invoice_grace` int(11) DEFAULT NULL,
  `invoice_advance_gen` int(11) DEFAULT NULL,
  `invoice_terms` int(11) DEFAULT NULL,
  `invoice_pdf_plugin` varchar(16) DEFAULT NULL,
  `contact_us_url` varchar(64) DEFAULT NULL,
  `contact_us_phone` varchar(64) DEFAULT NULL,
  `advance_notice` int(11) DEFAULT NULL,
  UNIQUE KEY `IDS` (`site_id`,`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_ssl`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_ssl` (
  `id` bigint(20) NOT NULL,
  `site_id` int(11) NOT NULL,
  `extensions` varchar(64) NOT NULL,
  PRIMARY KEY (`id`,`site_id`),
  KEY `fk_ssl_set_idx` (`site_id`),
  CONSTRAINT `fk_ssl_set` FOREIGN KEY (`site_id`) REFERENCES `sites` (`site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_ssl_ca`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_ssl_ca` (
  `id` bigint(20) NOT NULL,
  `site_id` int(11) NOT NULL,
  `account_id` bigint(20) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `sign_pk` text NOT NULL,
  `sign_cert` text NOT NULL,
  `parent_ssl_ca_id` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`account_id`),
  KEY `fk_sca_idx` (`parent_ssl_ca_id`,`site_id`),
  KEY `fk_sca_acc_idx` (`account_id`,`site_id`),
  CONSTRAINT `fk_sca` FOREIGN KEY (`parent_ssl_ca_id`, `site_id`) REFERENCES `ab_ssl_ca` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_sca_acc` FOREIGN KEY (`account_id`, `site_id`) REFERENCES `accounts` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_static_page`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_static_page` (
  `id` int(11) DEFAULT NULL,
  `site_id` int(11) DEFAULT NULL,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `static_page_category_id` int(11) DEFAULT NULL,
  `date_start` bigint(20) DEFAULT NULL,
  `date_expire` bigint(20) DEFAULT NULL,
  `sort_order` int(11) DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `name` varchar(128) DEFAULT NULL,
  `description` longtext DEFAULT NULL,
  UNIQUE KEY `IDS` (`site_id`,`id`),
  KEY `cat` (`static_page_category_id`),
  KEY `start` (`date_start`),
  KEY `expire` (`date_expire`),
  KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_static_page_category`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_static_page_category` (
  `id` int(11) DEFAULT NULL,
  `site_id` int(11) DEFAULT NULL,
  `date_orig` bigint(20) DEFAULT NULL,
  `group_avail` varchar(255) DEFAULT NULL,
  `name` varchar(128) DEFAULT NULL,
  `description` longtext DEFAULT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `sort_order` int(11) DEFAULT NULL,
  UNIQUE KEY `IDS` (`site_id`,`id`),
  KEY `name` (`name`),
  KEY `status` (`active`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_static_page_translate`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_static_page_translate` (
  `id` int(11) DEFAULT NULL,
  `site_id` int(11) DEFAULT NULL,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `static_page_id` int(11) DEFAULT NULL,
  `language_id` varchar(16) DEFAULT NULL,
  `body_intro` longtext DEFAULT NULL,
  `body_full` longtext DEFAULT NULL,
  `title` varchar(128) DEFAULT NULL,
  UNIQUE KEY `IDS` (`site_id`,`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_task`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_task` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `date_run` bigint(20) DEFAULT NULL,
  `active` int(11) DEFAULT NULL,
  `name` varchar(32) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `log` tinyint(4) DEFAULT NULL,
  `type` int(11) DEFAULT NULL,
  `command` varchar(128) DEFAULT NULL,
  `int_min` varchar(32) DEFAULT NULL,
  `int_hour` varchar(32) DEFAULT NULL,
  `int_month` varchar(32) DEFAULT NULL,
  `int_month_day` varchar(32) DEFAULT NULL,
  `int_week_day` varchar(32) DEFAULT NULL,
  `running` tinyint(4) DEFAULT NULL,
  `running_host` varchar(4) DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`),
  KEY `fk_tsk_set_idx` (`site_id`),
  CONSTRAINT `fk_tsk_set` FOREIGN KEY (`site_id`) REFERENCES `sites` (`site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_task_log`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_task_log` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `task_id` bigint(20) NOT NULL DEFAULT 0,
  `result` tinyint(4) DEFAULT NULL,
  `message` blob DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`,`task_id`),
  KEY `fk_tl_task` (`task_id`,`site_id`),
  CONSTRAINT `fk_tl_t` FOREIGN KEY (`task_id`, `site_id`) REFERENCES `ab_task` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_tax`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_tax` (
  `id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `country_id` int(11) NOT NULL DEFAULT 0,
  `zone` varchar(128) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `rate` double DEFAULT NULL,
  `tax_id_collect` tinyint(4) DEFAULT NULL,
  `tax_id_name` varchar(32) DEFAULT NULL,
  `tax_id_req` tinyint(4) DEFAULT NULL,
  `tax_id_exempt` tinyint(4) DEFAULT NULL,
  `tax_id_regex` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UNIQUE` (`country_id`,`zone`),
  KEY `fk_tax_cty_idx` (`country_id`),
  CONSTRAINT `fk_tax_cty` FOREIGN KEY (`country_id`) REFERENCES `ab_country` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `ab_voip_plan`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ab_voip_plan` (
  `id` bigint(20) DEFAULT NULL,
  `site_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `accounts`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `accounts` (
  `id` bigint(20) NOT NULL DEFAULT 0,
  `site_id` int(11) NOT NULL DEFAULT 0,
  `date_orig` bigint(20) DEFAULT NULL,
  `date_last` bigint(20) DEFAULT NULL,
  `date_expire` bigint(20) DEFAULT NULL,
  `language_id` int(11) NOT NULL,
  `country_id` int(11) NOT NULL,
  `rtm_id` bigint(20) DEFAULT NULL,
  `currency_id` int(11) NOT NULL,
  `active` tinyint(4) DEFAULT NULL,
  `company` varchar(255) DEFAULT NULL,
  `address1` varchar(128) DEFAULT NULL,
  `address2` varchar(128) DEFAULT NULL,
  `city` varchar(32) DEFAULT NULL,
  `state` varchar(32) DEFAULT NULL,
  `zip` varchar(16) DEFAULT NULL,
  `user_id` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`,`site_id`),
  KEY `fk_acc_set_idx` (`site_id`),
  KEY `fk_acc_lan_idx` (`language_id`),
  KEY `fk_acc_rtm_idx` (`rtm_id`,`site_id`),
  KEY `fk_acc_cty_idx` (`country_id`),
  KEY `fk_acc_cur_idx` (`currency_id`),
  KEY `ab_account_user_id_foreign` (`user_id`),
  CONSTRAINT `ab_account_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
  CONSTRAINT `fk_acc_cty` FOREIGN KEY (`country_id`) REFERENCES `ab_country` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_acc_cur` FOREIGN KEY (`currency_id`) REFERENCES `ab_currency` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_acc_lan` FOREIGN KEY (`language_id`) REFERENCES `ab_language` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_acc_rtm` FOREIGN KEY (`rtm_id`, `site_id`) REFERENCES `ab_rtm` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_acc_set` FOREIGN KEY (`site_id`) REFERENCES `sites` (`site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `external_account`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `external_account` (
  `account_id` bigint(20) NOT NULL,
  `site_id` int(11) DEFAULT NULL,
  `external_integration_id` int(10) unsigned NOT NULL,
  `link` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  UNIQUE KEY `sae` (`site_id`,`account_id`,`external_integration_id`),
  KEY `external_account_external_integration_id_foreign` (`external_integration_id`),
  KEY `external_account_account_id_foreign` (`account_id`),
  CONSTRAINT `external_account_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`),
  CONSTRAINT `external_account_external_integration_id_foreign` FOREIGN KEY (`external_integration_id`) REFERENCES `external_integrations` (`id`),
  CONSTRAINT `external_account_site_id_foreign` FOREIGN KEY (`site_id`) REFERENCES `sites` (`site_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `external_integrations`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `external_integrations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `external_integrations_user_id_foreign` (`user_id`),
  CONSTRAINT `external_integrations_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `failed_jobs`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `failed_jobs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `invites`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `invites` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `code` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `for` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `max` int(11) NOT NULL DEFAULT 1,
  `uses` int(11) NOT NULL DEFAULT 0,
  `valid_until` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `invites_code_unique` (`code`),
  UNIQUE KEY `invites_for_unique` (`for`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `jobs`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `jobs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `queue` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `attempts` tinyint(3) unsigned NOT NULL,
  `reserved_at` int(10) unsigned DEFAULT NULL,
  `available_at` int(10) unsigned NOT NULL,
  `created_at` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `jobs_queue_index` (`queue`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `migrations`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `migrations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `oauth_access_tokens`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `oauth_access_tokens` (
  `id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `client_id` int(11) NOT NULL,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `scopes` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `revoked` tinyint(1) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `expires_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `oauth_access_tokens_user_id_index` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `oauth_auth_codes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `oauth_auth_codes` (
  `id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` int(11) NOT NULL,
  `client_id` int(11) NOT NULL,
  `scopes` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `revoked` tinyint(1) NOT NULL,
  `expires_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `oauth_clients`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `oauth_clients` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `secret` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `redirect` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `personal_access_client` tinyint(1) NOT NULL,
  `password_client` tinyint(1) NOT NULL,
  `revoked` tinyint(1) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `oauth_clients_user_id_index` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `oauth_personal_access_clients`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `oauth_personal_access_clients` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `client_id` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `oauth_personal_access_clients_client_id_index` (`client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `oauth_refresh_tokens`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `oauth_refresh_tokens` (
  `id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `access_token_id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `revoked` tinyint(1) NOT NULL,
  `expires_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `oauth_refresh_tokens_access_token_id_index` (`access_token_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `password_resets`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `password_resets` (
  `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  KEY `password_resets_email_index` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `quickbooks_tokens`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `quickbooks_tokens` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `realm_id` bigint(20) unsigned NOT NULL,
  `access_token` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `access_token_expires_at` datetime NOT NULL,
  `refresh_token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `refresh_token_expires_at` datetime NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `quickbooks_tokens_user_id_foreign` (`user_id`),
  CONSTRAINT `quickbooks_tokens_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `service__generic`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `service__generic` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `site_id` int(11) NOT NULL,
  `service_id` bigint(20) NOT NULL,
  `product_id` bigint(20) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `service__generic_site_id_service_id_unique` (`site_id`,`service_id`),
  KEY `service__generic_service_id_site_id_foreign` (`service_id`,`site_id`),
  KEY `service__generic_product_id_site_id_foreign` (`product_id`,`site_id`),
  CONSTRAINT `service__generic_product_id_site_id_foreign` FOREIGN KEY (`product_id`, `site_id`) REFERENCES `ab_product` (`id`, `site_id`),
  CONSTRAINT `service__generic_service_id_site_id_foreign` FOREIGN KEY (`service_id`, `site_id`) REFERENCES `ab_service` (`id`, `site_id`),
  CONSTRAINT `service__generic_site_id_foreign` FOREIGN KEY (`site_id`) REFERENCES `sites` (`site_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `site_details`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `site_details` (
  `site_id` int(11) NOT NULL,
  `key` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `value` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  UNIQUE KEY `site_details_site_id_key_unique` (`site_id`,`key`),
  CONSTRAINT `site_details_site_id_foreign` FOREIGN KEY (`site_id`) REFERENCES `sites` (`site_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `sites`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sites` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `site_id` int(11) NOT NULL,
  `date_orig` bigint(20) DEFAULT NULL,
  `active` tinyint(1) NOT NULL,
  `country_id` int(11) NOT NULL,
  `language_id` int(11) NOT NULL,
  `currency_id` int(11) NOT NULL,
  `url` varchar(256) NOT NULL,
  `admin_id` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `sites_site_id_url_unique` (`site_id`,`url`),
  KEY `sites_site_id_index` (`site_id`),
  KEY `sites_country_id_foreign` (`country_id`),
  KEY `sites_currency_id_foreign` (`currency_id`),
  KEY `sites_language_id_foreign` (`language_id`),
  KEY `sites_admin_id_site_id_foreign` (`admin_id`,`site_id`),
  CONSTRAINT `sites_admin_id_site_id_foreign` FOREIGN KEY (`admin_id`, `site_id`) REFERENCES `users` (`id`, `site_id`),
  CONSTRAINT `sites_country_id_foreign` FOREIGN KEY (`country_id`) REFERENCES `ab_country` (`id`),
  CONSTRAINT `sites_currency_id_foreign` FOREIGN KEY (`currency_id`) REFERENCES `ab_currency` (`id`),
  CONSTRAINT `sites_language_id_foreign` FOREIGN KEY (`language_id`) REFERENCES `ab_language` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `site_id` int(11) NOT NULL,
  `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `password` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `active` tinyint(1) NOT NULL,
  `title` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `firstname` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `lastname` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `country_id` int(11) NOT NULL,
  `address1` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `address2` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `city` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `state` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `postcode` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `emailable` tinyint(1) NOT NULL DEFAULT 1,
  `parent_id` int(10) unsigned DEFAULT NULL,
  `language_id` int(11) DEFAULT NULL,
  `currency_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_site_id_email_unique` (`site_id`,`email`),
  KEY `users_parent_id_foreign` (`parent_id`),
  KEY `users_language_id_foreign` (`language_id`),
  KEY `users_currency_id_foreign` (`currency_id`),
  KEY `site_user_id_idx` (`id`,`site_id`),
  CONSTRAINT `users_currency_id_foreign` FOREIGN KEY (`currency_id`) REFERENCES `ab_currency` (`id`),
  CONSTRAINT `users_language_id_foreign` FOREIGN KEY (`language_id`) REFERENCES `ab_language` (`id`),
  CONSTRAINT `users_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

INSERT INTO `migrations` VALUES (1,'2016_06_01_000001_create_oauth_auth_codes_table',1);
INSERT INTO `migrations` VALUES (2,'2016_06_01_000002_create_oauth_access_tokens_table',1);
INSERT INTO `migrations` VALUES (3,'2016_06_01_000003_create_oauth_refresh_tokens_table',1);
INSERT INTO `migrations` VALUES (4,'2016_06_01_000004_create_oauth_clients_table',1);
INSERT INTO `migrations` VALUES (5,'2016_06_01_000005_create_oauth_personal_access_clients_table',1);
INSERT INTO `migrations` VALUES (6,'2017_04_04_185723_create_invites_table',1);
INSERT INTO `migrations` VALUES (7,'2018_05_14_122513_currency_add_rounding',1);
INSERT INTO `migrations` VALUES (8,'2018_05_20_052944_account_add_remember_token',1);
INSERT INTO `migrations` VALUES (301,'2017_06_18_104531_create_ab_account_billing_table',0);
INSERT INTO `migrations` VALUES (302,'2017_06_18_104531_create_ab_account_group_table',0);
INSERT INTO `migrations` VALUES (303,'2017_06_18_104531_create_ab_account_log_table',0);
INSERT INTO `migrations` VALUES (304,'2017_06_18_104531_create_ab_account_memo_table',0);
INSERT INTO `migrations` VALUES (305,'2017_06_18_104531_create_ab_account_oauth_table',0);
INSERT INTO `migrations` VALUES (306,'2017_06_18_104531_create_ab_account_table',0);
INSERT INTO `migrations` VALUES (307,'2017_06_18_104531_create_ab_adsl_plan_table',0);
INSERT INTO `migrations` VALUES (308,'2017_06_18_104531_create_ab_adsl_supplier_plan_table',0);
INSERT INTO `migrations` VALUES (309,'2017_06_18_104531_create_ab_adsl_supplier_table',0);
INSERT INTO `migrations` VALUES (310,'2017_06_18_104531_create_ab_affiliate_table',0);
INSERT INTO `migrations` VALUES (311,'2017_06_18_104531_create_ab_asset_pool_table',0);
INSERT INTO `migrations` VALUES (312,'2017_06_18_104531_create_ab_asset_table',0);
INSERT INTO `migrations` VALUES (313,'2017_06_18_104531_create_ab_cart_table',0);
INSERT INTO `migrations` VALUES (314,'2017_06_18_104531_create_ab_charge_table',0);
INSERT INTO `migrations` VALUES (315,'2017_06_18_104531_create_ab_checkout_notify_table',0);
INSERT INTO `migrations` VALUES (316,'2017_06_18_104531_create_ab_checkout_table',0);
INSERT INTO `migrations` VALUES (317,'2017_06_18_104531_create_ab_country_table',0);
INSERT INTO `migrations` VALUES (318,'2017_06_18_104531_create_ab_currency_table',0);
INSERT INTO `migrations` VALUES (319,'2017_06_18_104531_create_ab_discount_table',0);
INSERT INTO `migrations` VALUES (320,'2017_06_18_104531_create_ab_domain_registrar_table',0);
INSERT INTO `migrations` VALUES (321,'2017_06_18_104531_create_ab_domain_tld_table',0);
INSERT INTO `migrations` VALUES (322,'2017_06_18_104531_create_ab_email_log_table',0);
INSERT INTO `migrations` VALUES (323,'2017_06_18_104531_create_ab_email_setup_table',0);
INSERT INTO `migrations` VALUES (324,'2017_06_18_104531_create_ab_email_template_table',0);
INSERT INTO `migrations` VALUES (325,'2017_06_18_104531_create_ab_email_template_translate_table',0);
INSERT INTO `migrations` VALUES (326,'2017_06_18_104531_create_ab_export_datamap_table',0);
INSERT INTO `migrations` VALUES (327,'2017_06_18_104531_create_ab_export_item_table',0);
INSERT INTO `migrations` VALUES (328,'2017_06_18_104531_create_ab_export_module_table',0);
INSERT INTO `migrations` VALUES (329,'2017_06_18_104531_create_ab_export_table',0);
INSERT INTO `migrations` VALUES (330,'2017_06_18_104531_create_ab_group_method_table',0);
INSERT INTO `migrations` VALUES (331,'2017_06_18_104531_create_ab_group_table',0);
INSERT INTO `migrations` VALUES (332,'2017_06_18_104531_create_ab_host_server_affiliate_table',0);
INSERT INTO `migrations` VALUES (333,'2017_06_18_104531_create_ab_host_server_id_table',0);
INSERT INTO `migrations` VALUES (334,'2017_06_18_104531_create_ab_host_server_table',0);
INSERT INTO `migrations` VALUES (335,'2017_06_18_104531_create_ab_host_tld_id_table',0);
INSERT INTO `migrations` VALUES (336,'2017_06_18_104531_create_ab_import_table',0);
INSERT INTO `migrations` VALUES (337,'2017_06_18_104531_create_ab_invoice_item_discount_table',0);
INSERT INTO `migrations` VALUES (338,'2017_06_18_104531_create_ab_invoice_item_table',0);
INSERT INTO `migrations` VALUES (339,'2017_06_18_104531_create_ab_invoice_item_tax_table',0);
INSERT INTO `migrations` VALUES (340,'2017_06_18_104531_create_ab_invoice_memo_table',0);
INSERT INTO `migrations` VALUES (341,'2017_06_18_104531_create_ab_invoice_table',0);
INSERT INTO `migrations` VALUES (342,'2017_06_18_104531_create_ab_language_table',0);
INSERT INTO `migrations` VALUES (343,'2017_06_18_104531_create_ab_log_error_table',0);
INSERT INTO `migrations` VALUES (344,'2017_06_18_104531_create_ab_module_method_table',0);
INSERT INTO `migrations` VALUES (345,'2017_06_18_104531_create_ab_module_method_token_table',0);
INSERT INTO `migrations` VALUES (346,'2017_06_18_104531_create_ab_module_table',0);
INSERT INTO `migrations` VALUES (347,'2017_06_18_104531_create_ab_oauth_table',0);
INSERT INTO `migrations` VALUES (348,'2017_06_18_104531_create_ab_payment_item_table',0);
INSERT INTO `migrations` VALUES (349,'2017_06_18_104531_create_ab_payment_table',0);
INSERT INTO `migrations` VALUES (350,'2017_06_18_104531_create_ab_pivot_product_cat_table',0);
INSERT INTO `migrations` VALUES (351,'2017_06_18_104531_create_ab_product_cat_table',0);
INSERT INTO `migrations` VALUES (352,'2017_06_18_104531_create_ab_product_cat_translate_table',0);
INSERT INTO `migrations` VALUES (353,'2017_06_18_104531_create_ab_product_table',0);
INSERT INTO `migrations` VALUES (354,'2017_06_18_104531_create_ab_product_translate_table',0);
INSERT INTO `migrations` VALUES (355,'2017_06_18_104531_create_ab_record_id_table',0);
INSERT INTO `migrations` VALUES (356,'2017_06_18_104531_create_ab_rtm_table',0);
INSERT INTO `migrations` VALUES (357,'2017_06_18_104531_create_ab_service__adsl_table',0);
INSERT INTO `migrations` VALUES (358,'2017_06_18_104531_create_ab_service__adsl_traffic_table',0);
INSERT INTO `migrations` VALUES (359,'2017_06_18_104531_create_ab_service__domain_table',0);
INSERT INTO `migrations` VALUES (360,'2017_06_18_104531_create_ab_service__hosting_table',0);
INSERT INTO `migrations` VALUES (361,'2017_06_18_104531_create_ab_service__ssl_table',0);
INSERT INTO `migrations` VALUES (362,'2017_06_18_104531_create_ab_service__voip_table',0);
INSERT INTO `migrations` VALUES (363,'2017_06_18_104531_create_ab_service_change_table',0);
INSERT INTO `migrations` VALUES (364,'2017_06_18_104531_create_ab_service_memo_table',0);
INSERT INTO `migrations` VALUES (365,'2017_06_18_104531_create_ab_service_table',0);
INSERT INTO `migrations` VALUES (366,'2017_06_18_104531_create_ab_setup_invoice_table',0);
INSERT INTO `migrations` VALUES (367,'2017_06_18_104531_create_ab_setup_table',0);
INSERT INTO `migrations` VALUES (368,'2017_06_18_104531_create_ab_ssl_ca_table',0);
INSERT INTO `migrations` VALUES (369,'2017_06_18_104531_create_ab_ssl_table',0);
INSERT INTO `migrations` VALUES (370,'2017_06_18_104531_create_ab_static_page_category_table',0);
INSERT INTO `migrations` VALUES (371,'2017_06_18_104531_create_ab_static_page_table',0);
INSERT INTO `migrations` VALUES (372,'2017_06_18_104531_create_ab_static_page_translate_table',0);
INSERT INTO `migrations` VALUES (373,'2017_06_18_104531_create_ab_task_log_table',0);
INSERT INTO `migrations` VALUES (374,'2017_06_18_104531_create_ab_task_table',0);
INSERT INTO `migrations` VALUES (375,'2017_06_18_104531_create_ab_tax_table',0);
INSERT INTO `migrations` VALUES (376,'2017_06_18_104531_create_ab_voip_plan_table',0);
INSERT INTO `migrations` VALUES (377,'2017_06_18_104531_create_countries_table',0);
INSERT INTO `migrations` VALUES (378,'2017_06_18_104531_create_currencies_table',0);
INSERT INTO `migrations` VALUES (379,'2017_06_18_104531_create_sites_table',0);
INSERT INTO `migrations` VALUES (381,'2017_06_18_104533_add_foreign_keys_to_ab_account_billing_table',0);
INSERT INTO `migrations` VALUES (382,'2017_06_18_104533_add_foreign_keys_to_ab_account_group_table',0);
INSERT INTO `migrations` VALUES (383,'2017_06_18_104533_add_foreign_keys_to_ab_account_log_table',0);
INSERT INTO `migrations` VALUES (384,'2017_06_18_104533_add_foreign_keys_to_ab_account_oauth_table',0);
INSERT INTO `migrations` VALUES (385,'2017_06_18_104533_add_foreign_keys_to_ab_account_table',0);
INSERT INTO `migrations` VALUES (386,'2017_06_18_104533_add_foreign_keys_to_ab_adsl_plan_table',0);
INSERT INTO `migrations` VALUES (387,'2017_06_18_104533_add_foreign_keys_to_ab_adsl_supplier_plan_table',0);
INSERT INTO `migrations` VALUES (388,'2017_06_18_104533_add_foreign_keys_to_ab_adsl_supplier_table',0);
INSERT INTO `migrations` VALUES (389,'2017_06_18_104533_add_foreign_keys_to_ab_affiliate_table',0);
INSERT INTO `migrations` VALUES (390,'2017_06_18_104533_add_foreign_keys_to_ab_cart_table',0);
INSERT INTO `migrations` VALUES (391,'2017_06_18_104533_add_foreign_keys_to_ab_charge_table',0);
INSERT INTO `migrations` VALUES (392,'2017_06_18_104533_add_foreign_keys_to_ab_checkout_notify_table',0);
INSERT INTO `migrations` VALUES (393,'2017_06_18_104533_add_foreign_keys_to_ab_checkout_table',0);
INSERT INTO `migrations` VALUES (394,'2017_06_18_104533_add_foreign_keys_to_ab_currency_table',0);
INSERT INTO `migrations` VALUES (395,'2017_06_18_104533_add_foreign_keys_to_ab_domain_tld_table',0);
INSERT INTO `migrations` VALUES (396,'2017_06_18_104533_add_foreign_keys_to_ab_email_log_table',0);
INSERT INTO `migrations` VALUES (397,'2017_06_18_104533_add_foreign_keys_to_ab_email_setup_table',0);
INSERT INTO `migrations` VALUES (398,'2017_06_18_104533_add_foreign_keys_to_ab_email_template_table',0);
INSERT INTO `migrations` VALUES (399,'2017_06_18_104533_add_foreign_keys_to_ab_email_template_translate_table',0);
INSERT INTO `migrations` VALUES (400,'2017_06_18_104533_add_foreign_keys_to_ab_export_datamap_table',0);
INSERT INTO `migrations` VALUES (401,'2017_06_18_104533_add_foreign_keys_to_ab_export_item_table',0);
INSERT INTO `migrations` VALUES (402,'2017_06_18_104533_add_foreign_keys_to_ab_export_module_table',0);
INSERT INTO `migrations` VALUES (403,'2017_06_18_104533_add_foreign_keys_to_ab_export_table',0);
INSERT INTO `migrations` VALUES (404,'2017_06_18_104533_add_foreign_keys_to_ab_group_method_table',0);
INSERT INTO `migrations` VALUES (405,'2017_06_18_104533_add_foreign_keys_to_ab_group_table',0);
INSERT INTO `migrations` VALUES (406,'2017_06_18_104533_add_foreign_keys_to_ab_host_server_affiliate_table',0);
INSERT INTO `migrations` VALUES (407,'2017_06_18_104533_add_foreign_keys_to_ab_invoice_item_table',0);
INSERT INTO `migrations` VALUES (408,'2017_06_18_104533_add_foreign_keys_to_ab_invoice_item_tax_table',0);
INSERT INTO `migrations` VALUES (409,'2017_06_18_104533_add_foreign_keys_to_ab_invoice_memo_table',0);
INSERT INTO `migrations` VALUES (410,'2017_06_18_104533_add_foreign_keys_to_ab_invoice_table',0);
INSERT INTO `migrations` VALUES (411,'2017_06_18_104533_add_foreign_keys_to_ab_module_method_table',0);
INSERT INTO `migrations` VALUES (412,'2017_06_18_104533_add_foreign_keys_to_ab_module_method_token_table',0);
INSERT INTO `migrations` VALUES (413,'2017_06_18_104533_add_foreign_keys_to_ab_module_table',0);
INSERT INTO `migrations` VALUES (414,'2017_06_18_104533_add_foreign_keys_to_ab_oauth_table',0);
INSERT INTO `migrations` VALUES (415,'2017_06_18_104533_add_foreign_keys_to_ab_payment_item_table',0);
INSERT INTO `migrations` VALUES (416,'2017_06_18_104533_add_foreign_keys_to_ab_payment_table',0);
INSERT INTO `migrations` VALUES (417,'2017_06_18_104533_add_foreign_keys_to_ab_pivot_product_cat_table',0);
INSERT INTO `migrations` VALUES (418,'2017_06_18_104533_add_foreign_keys_to_ab_product_cat_table',0);
INSERT INTO `migrations` VALUES (419,'2017_06_18_104533_add_foreign_keys_to_ab_product_cat_translate_table',0);
INSERT INTO `migrations` VALUES (420,'2017_06_18_104533_add_foreign_keys_to_ab_product_table',0);
INSERT INTO `migrations` VALUES (421,'2017_06_18_104533_add_foreign_keys_to_ab_product_translate_table',0);
INSERT INTO `migrations` VALUES (422,'2017_06_18_104533_add_foreign_keys_to_ab_record_id_table',0);
INSERT INTO `migrations` VALUES (423,'2017_06_18_104533_add_foreign_keys_to_ab_rtm_table',0);
INSERT INTO `migrations` VALUES (424,'2017_06_18_104533_add_foreign_keys_to_ab_service__adsl_table',0);
INSERT INTO `migrations` VALUES (425,'2017_06_18_104533_add_foreign_keys_to_ab_service__adsl_traffic_table',0);
INSERT INTO `migrations` VALUES (426,'2017_06_18_104533_add_foreign_keys_to_ab_service__domain_table',0);
INSERT INTO `migrations` VALUES (427,'2017_06_18_104533_add_foreign_keys_to_ab_service__hosting_table',0);
INSERT INTO `migrations` VALUES (428,'2017_06_18_104533_add_foreign_keys_to_ab_service__ssl_table',0);
INSERT INTO `migrations` VALUES (429,'2017_06_18_104533_add_foreign_keys_to_ab_service_change_table',0);
INSERT INTO `migrations` VALUES (430,'2017_06_18_104533_add_foreign_keys_to_ab_service_memo_table',0);
INSERT INTO `migrations` VALUES (431,'2017_06_18_104533_add_foreign_keys_to_ab_service_table',0);
INSERT INTO `migrations` VALUES (432,'2017_06_18_104533_add_foreign_keys_to_ab_setup_table',0);
INSERT INTO `migrations` VALUES (433,'2017_06_18_104533_add_foreign_keys_to_ab_ssl_ca_table',0);
INSERT INTO `migrations` VALUES (434,'2017_06_18_104533_add_foreign_keys_to_ab_ssl_table',0);
INSERT INTO `migrations` VALUES (435,'2017_06_18_104533_add_foreign_keys_to_ab_task_log_table',0);
INSERT INTO `migrations` VALUES (436,'2017_06_18_104533_add_foreign_keys_to_ab_task_table',0);
INSERT INTO `migrations` VALUES (437,'2017_06_18_104533_add_foreign_keys_to_ab_tax_table',0);
INSERT INTO `migrations` VALUES (438,'2017_06_18_104533_add_foreign_keys_to_countries_table',0);
INSERT INTO `migrations` VALUES (439,'2018_06_18_114830_currency_change_threecode',2);
INSERT INTO `migrations` VALUES (440,'2017_06_18_104531_create_users_table',3);
INSERT INTO `migrations` VALUES (441,'2018_06_22_062015_account_add_user',4);
INSERT INTO `migrations` VALUES (442,'2018_06_22_062022_user_add_heirachy',4);
INSERT INTO `migrations` VALUES (443,'2018_07_10_034223_users_add_language',4);
INSERT INTO `migrations` VALUES (444,'2018_07_28_234942_create_site_details',5);
INSERT INTO `migrations` VALUES (445,'2014_10_12_100000_create_password_resets_table',6);
INSERT INTO `migrations` VALUES (446,'2018_08_10_115648_service_add_status',7);
INSERT INTO `migrations` VALUES (447,'2019_01_24_142111_create_jobs_table',8);
INSERT INTO `migrations` VALUES (448,'2019_01_24_175606_create_failed_jobs_table',9);
INSERT INTO `migrations` VALUES (449,'2019_06_02_163527_add_model_to_service',10);
INSERT INTO `migrations` VALUES (450,'2018_03_11_141103_create_quick_books_tokens_table',11);
INSERT INTO `migrations` VALUES (451,'2019_06_11_160940_add_external',11);
INSERT INTO `migrations` VALUES (452,'2019_06_11_161150_add_external_account',11);
INSERT INTO `migrations` VALUES (453,'2019_06_29_101655_add_model_to_product',12);
INSERT INTO `migrations` VALUES (454,'2019_07_05_092048_add_user_to_accountoauth',12);
INSERT INTO `migrations` VALUES (455,'2020_04_22_231133_change_service_number_adsl',13);
INSERT INTO `migrations` VALUES (456,'2020_05_27_144223_enhance_adsl_traffic',14);
INSERT INTO `migrations` VALUES (457,'2020_07_24_153836_addpending_to_payment',15);
INSERT INTO `migrations` VALUES (458,'2020_12_01_225123_add_service_generic',16);
INSERT INTO `migrations` VALUES (459,'2021_06_30_171340_rename_setup',17);
INSERT INTO `migrations` VALUES (460,'2021_07_07_164413_rework_account',17);
