0

I've got a massively diverged commerce development site, and I'd like to import all of the orders, line items, users, and customer profiles that have happened on the production site into my development site and then push the database back up to production.

I exported a bunch of tables and then ended up with a significantly borked dev site. Hmm.

I can continue to tweak my tables, but is there a better way to do this?

2
  • We've got the same pain. Did you look into the Migrate module? But: Do you really want to do this? I usually do it the other way round: Bundle my changes into Features, pull a new copy to dev from live and add my feature there (so live is always leading since authors working on the live site/content/menus etc.)
    – Chris
    Commented Jul 2, 2015 at 2:08
  • I have sooo many changes. They reached a threshold of complexity that surpassed the order migration a ways back. It'd be more time testing. Plus I'm migrating servers already. Commented Jul 2, 2015 at 15:01

1 Answer 1

1

I ended up exporting the tables from Sequel Pro using the "DROP TABLE IF EXISTS" syntax and then importing them (see screenshot).

If you don't use the DROP TABLE syntax (I believe this is the option in phpmyadmin) then just delete the tables before importing.

Basically, I spent a half an hour browsing the field_data_fieldname tables and others to see what sort of content they had and if they were pertinent to orders, line items, or users. I erred on the side of more db tables rather than less.

One of my field_data_fieldname fields was shared with other entity types, in addition to commerce_order, and so rather than clobber the incoming values, I had to create INSERT queries. Using Sequel Pro cut and paste did that for me. Make sure to get the field_revisions_fieldname table as well.

Make sure you empty out your cart before you import, else the cart will point to a possibly non-existent order and throw an entity metadata wrapper exception.

Here's the full list of tables:

`commerce_customer_profile`;
`commerce_customer_profile_revision`;
`commerce_line_item`;
`commerce_order`;
`commerce_order_revision`;
`commerce_payment_transaction`;
`commerce_payment_transaction_revision`;
`field_data_commerce_customer_address`;
`field_data_commerce_customer_billing`;
`field_data_commerce_customer_shipping`;
`field_data_commerce_line_items`;
`field_data_commerce_order_total`;
`field_data_commerce_shipping_service`;
`field_data_commerce_total`;
`field_data_commerce_unit_price`;
`field_data_message_commerce_body`;
`field_data_message_commerce_line_item`;
`field_data_message_commerce_order`;
`field_data_message_commerce_payment`;
`field_data_message_order_display_name`;
`field_data_message_text`;
`field_revision_commerce_customer_address`;
`field_revision_commerce_customer_billing`;
`field_revision_commerce_customer_shipping`;
`field_revision_commerce_shipping_service`;
`field_revision_commerce_total`;
`field_revision_commerce_unit_price`;
`field_revision_field_phone_number`;
`og_role`;
`og_role_permission`;
`og_users_roles`;
`users`;
`users_roles`;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.