12 January 2012 at 1:19pm
Hi, I'm fairly new to SilverStripe and just trying to figure it all out.
Both of us have macs, are using MAMP to develop locally and are using a shared repository at bitbucket under GIT version control. However, I am unsure as to how I can keep the database in sync between us. Ideally both of us should be able to make changes to the database (add pages, change content, or install a new module) and be kept up to date with each other. Is this possible? Or is there a better way?
I have heard about MYSQL replication but I'm not sure if this is really what I'm after or how that works?
14 January 2012 at 4:14pm
(Last edited: 14 January 2012 4:15pm),
You could host the MySQL database on a remote live server which both of you have access to but usually when working with multiple devs each has their own local database to connect to. The reason for this is SS will make changes to the database whenever you add code, so if you add code that other devs don't have then you'll break their copy of the site.
If you need to populate the database, I've found writing BuildTasks or using requireDefaultRecords() to create / populate content programmatically.
14 January 2012 at 6:37pm
Hey thanks for your insight Willr. I hadn't realized SS would change the database when code was changed and thus cause problems. As such, I think it probably would be best if we kept our databases separate. However, if we both synced our code together completely (at any time) what would then be the best way for us to sync the database? Would the one with the more complete database simply export theirs and the other import it? Is there any kind of way to automatically merge both the databases together if both of us had unique tables or content?
As an example: We both have the same code but I've added a few pages of certain page types and with certain content and he's added some other pages with certain content. How could we sync up without losing either ones additions?
17 January 2012 at 11:17pm
I'd suggest storing any content, pages you need to create as a BuildTask which creates the pages, values you need via the ORM then you can keep all that information in version control and share the data between developers. They could then run dev/tasks/ImportContent (or whatever you call your task) to create all the data.