How to develop and deploy an existing Commerce site

left's picture

Hi everyone,

I've a rather particular scenario to put forth - I was hoping someone could share similar experiences, or help guide my research.

My current project involves D7, Commerce (Kickstarter), multi-language.

There is an existing site which is live, and I am developing a alternative "new, and improved" version, based on the existing configuration. I started with a copy of the live site, and have developed it further.

I am preparing to deploy my dev version.

The live version will have gained new users and commerce orders, since I last made a copy of its database.

My deployment options seem to be:

A. Deploy my changes (files, media, configuration) to live site
B. Merge live site (users, orders) with dev version, then deploy dev version.

I am leaning towards Opt B

Examples of changes I have made to my dev version -

  • installed and uninstalled modules
  • created new theme
  • converted content types
  • reconfigured Views
  • introduced custom view modes
  • added fields to content types
  • populated those fields
  • added field collections
  • added custom blocks
  • created contexts
  • content translation
  • menu translation
  • some Commerce product variation type field display - can easily be recreated manually

I am not too experienced using the Features module and so I am not sure if using it would make it possible to deploy all my changes (as in Opt A), hence my leaning towards Opt B.

I will be developing the dev site more once I deploy this stage, so I will either need to repeat this deployment process or use the Features module going forward, probably with more bite-size changes.

I am not too concerned with the live site's content-related changes, as these have been tracked and can be recreated manually (there aren't many).

I would like the opportunity to explore the database structure in Drupal moreso too, but my understanding is lacking.

I am concerned it's not a simple "export/import users table" - at least, not in relation to commerce, so if I attempt this, I will accidentally omit data.

My specific questions are:
What tables are associated with Drupal users
What tables are associated with Commerce
how would I (or anyone) find this out?

Would doing a db dump from live site and comparing the diff with my dev mysql be informative? Would I be able to add users and commerce entities that way?

Feel free to poke holes in my thought-process and/or deployment options! Maybe there is an option C?

Thanks for any advice, suggestions, direction :)


I've done lots of work on

anthonylindsay's picture

I've done lots of work on existing Commerce sites and Features is your friend.

It's quite happy to capture content types, contexts, views etc so sounds perfect for lots of your deployment needs.

Installing and uninstalling modules could be handled between version control and an update hook.

Translation strings are content though so I don't know of an easy work around there. Content is for the live site.

I would very much try to avoid messing with the live DB if you could.

As for your specific questions,
- 'users' table covers Drupal users, along with 'users_roles 'and by extension 'role'. Of course, if users have fields on them, that expands things quite a lot. And if you're using Profile2...
- Commerce is more extensive. Any table prefaced with 'commerce' is a Commerce table, but also, everything in Commerce is an entity, so customer profile entities can have fields, commerce products can have fields, etc.

I would definitely recommend
- make your changes on dev
- capture the changes in Features and update hooks
- apply to live and run you update hooks
- make content changes on live if necessary

An extra environment

markconroy's picture

You might also want to put in a further "pre-live" environment, so you can have that as an exact replica of your live site (unless you already have that dev if you are developing locally).

One issue I found a little irksome was that commerce views did not get captured in features (I think there might be a module for same, or maybe I was just doing something wrong). So, you might need to clone those views, disable them, and then put the cloned versions in features (iirc - it's been a while since I deployed a commerce site).

Also, when it comes to features, be granular - one view per feature, one content type, one context, etc - takes a bit longer, but you'll thank me when you have a feature that doesn't feel like reverting (the best tip I got at DrupalCon Prague).

First attempt was interesting

left's picture

Thanks for the feedback. Really helpful. I went boldly forward and...well, questions and then a big brick wall.

Features is my friend - Part I

My process:

  • Create loads of features on dev site, and experiment installing on staging, seeing where things break etc
  • Dealing with conflicting features, googling, recreating, reinstalling
  • Researching update hooks and just not getting it !@#?
  • Attempting an update hook in a custom module (maybe I'll bring it to the next meeting)
    I'd love it if people could elaborate on a few approaches here
  1. Do you create "base" features of each base field?
  2. If a feature shares a base field, how do you create features that are independent from one another without conflicts?
  3. Do you avoid sharing fields between content types if you are using Features?
  4. @Mark - your advice about making them granular was a nice starting point.
  5. Are blocks and their placement considered content? Is positioning blocks in regions something I would expect to manually recreate on the live site? (Is using Features a good a reason to place all blocks using Context?)
  6. It seems taxonomy vocabularies can be featurised, but their terms aren't included - are they considered content too? Or am I doing something wrong?
  7. How do you manage your features and keep everything organised? I imagine I import them into the site that creates them, and update them each time I change any configuration...
  8. How many is too many features?!
  9. Can you give me an example of when you'd need to use an update hook?

Features is my friend - Part II

The wall. I might have encountered an issue that is unrelated to this task. But then again, maybe not...

My process continued:

  • Copy live site to staging - for real this time :)
  • Adding my new theme files, adjusting appearance settings
  • Drush to install and enable Media module, clear cache

I get this error in Drush:

drush cc all
WD php: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown[error]
column 'base.type' in 'field list': SELECT base.fid AS fid, base.uid
AS uid, base.filename AS filename, base.uri AS uri, base.filemime AS
filemime, base.filesize AS filesize, base.status AS status,
base.timestamp AS timestamp, base.type AS type
{file_managed} base
WHERE  (base.fid IN  (:db_condition_placeholder_0)) ; Array
    [:db_condition_placeholder_0] => 0
in DrupalDefaultEntityController->load() (line 191 of
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base.type' in 'field list': SELECT base.fid AS fid, base.uid AS uid, base.filename AS filename, base.uri AS uri, base.filemime AS filemime, base.filesize AS filesize, base.status AS status, base.timestamp AS timestamp, base.type AS type
{file_managed} base
WHERE  (base.fid IN  (:db_condition_placeholder_0)) ; Array
    [:db_condition_placeholder_0] => 0
in DrupalDefaultEntityController->load() (line 191 of /includes/
Drush command terminated abnormally due to an unrecoverable error.   [error]
Drush was not able to start (bootstrap) Drupal.                      [error]
Hint: This error can only occur once the database connection has
already been successfully initiated, therefore this error generally
points to a site configuration issue, and not a problem connecting to
the database.

And I can go no further.

The browser displays a generic system error message. Sometimes I could access the module manager to disable the Media module and File Entity but other times, I would get force logged out.

Might point to Media module:
I've verified database permissions are not the issue. Media module is needed for a lot of my features.

Any ideas how I'd troubleshoot this?
*If it seems unrelated to this thread, feel free to ignore.

Despite my troubles, I'm glad I didn't go messing with the database :)