0

I have Craft set up and am using it for the first time. It seems to be ok. I am using git to back up my project to Github and push/pull it between computers as I partly work on my desktop (Windows) but also work on my laptop (Mac).

My issue is that when I pull to another PC often Craft database stuff is not the same. I lose changes made e.g. images that I’ve uploaded (even though they are in the actual Craft Image folder in my folders) or Matrix changes. I didn’t realise this was happening and at first assumed my images weren’t updated because I’d forgotten to push to git before making changes on my laptop but when I went to pull my laptop changes to my Desktop last night and then tried accessing my Craft website through MAMP I got this error :

Craft\MatrixBlockModel and its behaviors do not have a method or closure named "myBlockSummary".

"myBlockSummary" is a matrix thing I added last night on my laptop. My sass and html and image files are moving correctly with git which is why Craft is confused(?), looking for something on the database (myBlockSummary) which I suppose isn’t there. The website works on the laptop that I pulled it from.

How can I easily continue using git and going between computers but have the database be included also?

This information on using Craft with git has not helped me really: https://craftcms.com/help/craft-storage-gitignore “So unless you have a way to keep the databases in sync between servers, there’s not a whole lot of point to sharing these files.” Are they saying this is not possible?

Thank you for any help.

2

It's a good practice to designate one instance on one computer (or server) as the "canonical" instance. You can make all database changes there, adding fields, etc. It's easy to download that database via the Backup Database tool in the admin panel. You can then import that dump file into databases on other machines as needed with a tool like SequelPro (Mac).

Some prefer to include an updated database dump file in the git repo every time a change is made but that can get pretty tricky.

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.