Jump to:

23355 Posts in 17834 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » SilverStripe Database Sync

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 536 Views
  • agentdylan
    Avatar
    Community Member
    2 Posts

    SilverStripe Database Sync Link to this post

    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?

  • Willr
    Avatar
    Forum Moderator
    5482 Posts

    Re: SilverStripe Database Sync Link to this post

    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.

  • agentdylan
    Avatar
    Community Member
    2 Posts

    Re: SilverStripe Database Sync Link to this post

    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?

    Cheers

  • Willr
    Avatar
    Forum Moderator
    5482 Posts

    Re: SilverStripe Database Sync Link to this post

    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.

    536 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.