I wanted to copy my live shop (1.9.0.1) to a staging environment.
The first time i did it it went ok, but i have configured the VAT and tax in admin sales>taxes and that is working ok, but for some reason this gives me an error on copying the database
Here is the error
Error
SQL-query:
--
-- Limitations for table sales_order_tax_item
--
ALTER TABLE sales_order_tax_item
ADD CONSTRAINT FK_SALES_ORDER_TAX_ITEM_ITEM_ID_SALES_FLAT_ORDER_ITEM_ITEM_ID
FOREIGNKEY ( item_id
) REFERENCES sales_flat_order_item
( item_id
) ON DELETE CASCADE ON UPDATE CASCADE ,
ADD CONSTRAINT FK_SALES_ORDER_TAX_ITEM_TAX_ID_SALES_ORDER_TAX_TAX_ID
FOREIGN KEY ( tax_id
) REFERENCES sales_order_tax
(tax_id
) ON DELETE CASCADE ON UPDATE CASCADE ;
MySQL: 
1452 - Cannot add or update a child row: a foreign key constraint fails (webshop_stn15
.#sql-60a_9df5d
, CONSTRAINT FK_SALES_ORDER_TAX_ITEM_TAX_ID_SALES_ORDER_TAX_TAX_ID
FOREIGN KEY (tax_id
) REFERENCES sales_order_tax
(tax_id
) ON DELETE CASCADE ON UPDAT)
I checked the original database and these tables are exactly the same so why am i having this problem?
X SELECT item_id FROM sales_flat_order_item
;
X SELECT tax_id
FROM sales_order_tax
;
these are both empty but so are they in the original database
I have no experience with this kind of stuff so i hope to find someone here that can help me out ;-)
Thanks
EDIT: i created a new subdomain and a new empty database. Than copied all files from live setup to the staging subdomain, changed the lines in local.xml with db password, user etc. and exported the live database which i imported in new database... this gave the error above.
i added this edit because everybody seems to think that i dropped these files in an old setup but that is not true... the first time i created a staging setup i havent had these issues...
EDIT 2 : PROBLEM SOLVED - I only had to check the option on export : check foreign keys