Skip to content
This repository has been archived by the owner on Apr 22, 2019. It is now read-only.

Split database #54

Closed
keiant25 opened this issue Mar 13, 2017 · 5 comments
Closed

Split database #54

keiant25 opened this issue Mar 13, 2017 · 5 comments

Comments

@keiant25
Copy link

keiant25 commented Mar 13, 2017

The extension does not install on magento enterprise because it says:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sales_invoice' doesn't exist, query was: DESCRIBE sales_invoice

This happens when the split mode its enabled.

@erikhansen
Copy link
Contributor

At this time the AvaTax extension does not support Magento Enterprise's split mode and we don't have this on our roadmap.

Per this page one of the requirements of using Magento's split database feature is that custom extensions can not "Use foreign keys to tables in the checkout, sales, or main databases". We are actually just getting ready to release a new version of this extension (see this PR) that will add foreign key constraints to the sales_invoice and sales_creditmemo tables, so this would make this extension even more incompatible with this mode.

@rsisco Can you take a look at the requirements of Enterprise's split database mode and come up with a level of effort for supporting it?

@erikhansen
Copy link
Contributor

@keiant25 We've added support for Magento Enterprise's Split Database mode to the develop branch. We have not yet released this as an official release. We've tested this locally, but would you be willing to test this in your environment to ensure everything works for you? Here are instructions on how to install the extension from the develop branch:

Run these commands in your root Magento installation directory:

composer require classyllama/module-avatax:dev-develop
bin/magento module:enable --clear-static-content ClassyLlama_AvaTax 
bin/magento setup:upgrade 
bin/magento cache:flush

@erikhansen
Copy link
Contributor

Split database support has been added in version 1.0.0 of this extension: https://github.com/classyllama/ClassyLlama_AvaTax/releases/tag/1.0.0

@wsagen
Copy link

wsagen commented Oct 26, 2017

Hey @erikhansen - I'm curious how you have got past the restriction to not use foreign keys against the sales tables in this instance?

@erikhansen
Copy link
Contributor

@wsagen Take a look at this commit: https://github.com/classyllama/ClassyLlama_AvaTax/pull/58/files#diff-f28060adec80b6f03a1ae1302d809fffR34

What we did is we moved our custom DB tables into the "sales" connection so that our custom table could have foreign key constraints on other sales tables. It wouldn't work if we were trying to perform a foreign key constraint between the connection types. For your easy reference, here is the "create syntax" for one of the AvaTax tables that uses foreign key constraints:

CREATE TABLE `avatax_sales_invoice` (
  `entity_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Entity ID',
  `parent_id` int(10) unsigned NOT NULL COMMENT 'Sales Invoice ID',
  `is_unbalanced` smallint(5) unsigned DEFAULT NULL COMMENT 'Is Unbalanced In Relation To AvaTax Calculated Tax Amount',
  `base_avatax_tax_amount` decimal(12,4) DEFAULT NULL COMMENT 'Base AvaTax Calculated Tax Amount',
  PRIMARY KEY (`entity_id`),
  KEY `AVATAX_SALES_INVOICE_ENTITY_ID_PARENT_ID` (`entity_id`,`parent_id`),
  KEY `FK_F7B202752CA0A3244E879AF8ABB5C83E` (`parent_id`),
  CONSTRAINT `FK_F7B202752CA0A3244E879AF8ABB5C83E` FOREIGN KEY (`parent_id`) REFERENCES `sales_invoice` (`entity_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8 COMMENT='AvaTax Sales Invoice Table';

Note: the above table was created using the InstallSchema class.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants