9

I am aware that modules have install and data setup scripts to make the DB portable from dev to production.

But in our case we have UI developers who add attributes and products through the admin interface which gets stored in the development DB.

On release day, we can't repeat all the steps we made in the dev environment, since it will be too tedious and time consuming.

Is there a way to handle such DB changes when deploying.

For now we are performing a diff between the dev DB and prod DB and generating a SQL which gets run on release day. But this is little dangerous since the dev DB might contain test transactional data and we can end up locking transactional tables in prod if our SQL has any statements modifying transactional tables.

Is there best practice around this? Thanks for the help in advance

8

There are different extensions for migrating data between environments but using them is shooting yourself into a foot. You definitely don't want to screw your production environment if something will go wrong.

The only right way to migrate data is to use setup scripts.

Also it will allow setting up new environments (for example for new fishes of your team) which will be up to date with the current state of things.

Good question by the way.

  • I have personally found that some of the modules from Magento Connect are not always completely compatible in terms of running setup scripts from scratch. I still have to work out exactly what happened, but our store setup is in a state such that, starting from an empty database, the install scripts conflict with each other and the store cannot bootstrap the empty database. In order to start from scratch again, we would need to apply the modules one at a time in order. Or fix bugs in software we didn't write. – nbering Sep 2 '15 at 0:55
  • How do you put into a script changes made from the Magento admin panel? For example: add attributes and products, or change some extension's configuration? – Andrea Sep 25 '16 at 9:26
  • 1
    @Andrea you just don't do changes in Magento admin panel. Everything through setup scripts. Of course in some occasions if you want to try something you are not sure yet you eventually do change something in admin but in this case those changes must be reverted and applied once again through setup script. – Foo Bar Sep 25 '16 at 18:58
  • As an FYI. We ended up using setup scripts for most changes. Fortunately our UI developer didn't mind doing setup scripts once he got a hang of it. You can also create ticket for new setup script creation and assign it to your developers. We also have a marketing team which uses the CMS feature of magento. Instead of doing these changes in dev environment, we asked them to make these changes in production directly. We added a CMS role which would only give them access to CMS features only. We then occasionally publish CMS changes from Prod to Stage and then QA and Dev using a custom script. – Jeetendra Pujari Sep 30 '16 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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