2

I have been testing magento latetly and I have been trying to figure the best way to track it with git. I created a new clean repository on GitHub and deployed it on a demo server where I invited colleagues to test drive it. The issue I faced is that several plugins where installed on production that made the branch on git & the production to be diverged. What's the suggested way to resolve this?

Install plugins / extensions ONLY on development, push it to git and then deploy to production? What if these plugins have db changes? Do migrations exist in magento?

2

It's going to be tricky to come up with a standard answer -- if I was running a Magento team I'd put none of the core code in source control, force my developers to build all their functionality in modules, and then have a build process automatically deploy everything.

Re: Migrations, yes, Magento has migrations. Magento calls migrations "Setup Resources". Covering them entierly is too large for a single Stack Exchange answer, but in my original Magento for PHP MVC Developers series I have an article on setup resources that should cover setting them up. The short list of tasks is

  1. Configure a setup resource class in your config.xml

  2. Create an install or upgrade script in your module's sql folder

  3. The install or upgrade script is included from an an object of the class from step 1, that's what $this refers to

Look at other Magento core modules for examples, as well as the Setup Resource article on the Magento website (based on my original, somewhat dated article linked above)

1

The best way is to install plugins on dev server (demo), test them, commit to repository. After that you can safely deploy to production. Magento extensions have migrations. So all DB changes will be safely done on production also.

  • Where are the db migrations saved at? – HaCos Jun 27 '14 at 14:02
0

Magento extensions come with their own sql scripts which will execute on the DB if the module is found to be active, but the necessary elements are not present in the database.

These scripts can be found in app/code/local/APP_COMPANY/APP_NAME/sql/APP_NAME_setup/mysql-install-VERSION

It could sit in the /community/ folder rather than the /local/ folder depending on what the module's creators did.

Magento does the work for you. Just dont forget to clear the cache via System > Cache Management after git pull in your production server

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.