diff --git a/database/schema/mysql-schema.dump b/database/schema/mysql-schema.dump index ee4efbd..809b673 100644 --- a/database/schema/mysql-schema.dump +++ b/database/schema/mysql-schema.dump @@ -4,53 +4,6 @@ /*!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`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ab_account` ( - `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, - `username` varchar(128) DEFAULT NULL, - `password` varchar(128) DEFAULT NULL, - `active` tinyint(4) DEFAULT NULL, - `first_name` varchar(128) DEFAULT NULL, - `last_name` varchar(128) DEFAULT NULL, - `title` varchar(128) DEFAULT NULL, - `email` varchar(255) 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, - `email_type` tinyint(4) DEFAULT NULL, - `invoice_delivery` int(11) DEFAULT NULL, - `mail_type` set('EMAIL','POST') DEFAULT NULL, - `remember_token` varchar(100) DEFAULT NULL, - `user_id` int(10) unsigned DEFAULT NULL, - PRIMARY KEY (`id`,`site_id`), - UNIQUE KEY `uq_username` (`site_id`,`username`), - 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 `ab_setup` (`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_billing`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -67,7 +20,7 @@ CREATE TABLE `ab_account_billing` ( 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 `ab_account` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + 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 */; @@ -88,7 +41,7 @@ CREATE TABLE `ab_account_group` ( 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 `ab_account` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + 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 */; @@ -104,7 +57,7 @@ CREATE TABLE `ab_account_log` ( `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 `ab_account` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION + 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`; @@ -143,7 +96,7 @@ CREATE TABLE `ab_account_oauth` ( 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 `ab_account` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + 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; @@ -191,7 +144,7 @@ CREATE TABLE `ab_adsl_supplier` ( `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 `ab_setup` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION + 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`; @@ -251,7 +204,7 @@ CREATE TABLE `ab_affiliate` ( `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 `ab_account` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION + 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`; @@ -327,7 +280,7 @@ CREATE TABLE `ab_charge` ( 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 `ab_account` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + 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; @@ -351,7 +304,7 @@ CREATE TABLE `ab_checkout` ( `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 `ab_setup` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION + 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`; @@ -505,7 +458,7 @@ CREATE TABLE `ab_email_log` ( 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 `ab_account` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + 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; @@ -535,7 +488,7 @@ CREATE TABLE `ab_email_setup` ( `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 `ab_account` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION + 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`; @@ -585,7 +538,7 @@ CREATE TABLE `ab_export` ( 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 `ab_setup` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION + 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`; @@ -659,7 +612,7 @@ CREATE TABLE `ab_group` ( `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 `ab_setup` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION + 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`; @@ -765,7 +718,7 @@ CREATE TABLE `ab_invoice` ( `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 `ab_account` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION + 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`; @@ -852,7 +805,7 @@ CREATE TABLE `ab_invoice_memo` ( 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 `ab_account` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + 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 */; @@ -899,7 +852,7 @@ CREATE TABLE `ab_module` ( 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 `ab_setup` (`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`; @@ -935,7 +888,7 @@ CREATE TABLE `ab_module_method_token` ( 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 `ab_account` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + 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 */; @@ -952,7 +905,7 @@ CREATE TABLE `ab_oauth` ( 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 `ab_setup` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION + 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`; @@ -979,8 +932,8 @@ CREATE TABLE `ab_payment` ( 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 `ab_account` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `fk_pay_acc_b` FOREIGN KEY (`source_id`, `site_id`) REFERENCES `ab_account` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + 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 */; @@ -1045,7 +998,7 @@ CREATE TABLE `ab_product` ( `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 `ab_setup` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION + 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`; @@ -1065,7 +1018,7 @@ CREATE TABLE `ab_product_cat` ( 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 `ab_setup` (`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`; @@ -1116,7 +1069,7 @@ CREATE TABLE `ab_record_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 `ab_setup` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION + 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`; @@ -1132,7 +1085,7 @@ CREATE TABLE `ab_rtm` ( 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 `ab_account` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + 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 */; @@ -1171,7 +1124,7 @@ CREATE TABLE `ab_service` ( 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 `ab_account` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + 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 */; @@ -1339,7 +1292,7 @@ CREATE TABLE `ab_service_change` ( 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 `ab_account` (`site_id`, `id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + 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; @@ -1358,39 +1311,10 @@ CREATE TABLE `ab_service_memo` ( 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 `ab_account` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + 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`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ab_setup` ( - `id` int(11) NOT NULL, - `date_orig` bigint(20) DEFAULT NULL, - `active` tinyint(4) DEFAULT NULL, - `country_id` int(11) NOT NULL, - `language_id` int(11) NOT NULL, - `currency_id` int(11) NOT NULL, - `url` varchar(256) NOT NULL DEFAULT '', - `login_expire` int(11) DEFAULT NULL, - `time_format` text DEFAULT NULL, - `date_format` text DEFAULT NULL, - `decimal_place` int(11) DEFAULT NULL, - `module_config` blob DEFAULT NULL, - `site_details` blob DEFAULT NULL, - `admin_id` bigint(20) DEFAULT NULL, - PRIMARY KEY (`id`,`country_id`,`currency_id`,`url`), - KEY `fk_set_cty_idx` (`country_id`), - KEY `fk_set_cur_idx` (`currency_id`), - KEY `fk_set_lan_idx` (`language_id`), - KEY `fk_set_acc_idx` (`admin_id`,`id`), - CONSTRAINT `fk_set_acc` FOREIGN KEY (`admin_id`, `id`) REFERENCES `ab_account` (`id`, `site_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `fk_set_cty` FOREIGN KEY (`country_id`) REFERENCES `ab_country` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `fk_set_cur` FOREIGN KEY (`currency_id`) REFERENCES `ab_currency` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `fk_set_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_setup_invoice`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -1425,7 +1349,7 @@ CREATE TABLE `ab_ssl` ( `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 `ab_setup` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION + 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`; @@ -1444,7 +1368,7 @@ CREATE TABLE `ab_ssl_ca` ( 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 `ab_account` (`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`; @@ -1526,7 +1450,7 @@ CREATE TABLE `ab_task` ( `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 `ab_setup` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION + 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`; @@ -1574,6 +1498,42 @@ CREATE TABLE `ab_voip_plan` ( `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 */; @@ -1585,9 +1545,9 @@ CREATE TABLE `external_account` ( 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 `ab_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 `ab_setup` (`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`; @@ -1774,7 +1734,7 @@ CREATE TABLE `service__generic` ( 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 `ab_setup` (`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`; @@ -1785,9 +1745,35 @@ CREATE TABLE `site_details` ( `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 `ab_setup` (`id`) + 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 */; @@ -1996,3 +1982,5 @@ INSERT INTO `migrations` VALUES (455,'2020_04_22_231133_change_service_number_ad 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);