SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Mar 2003
    In a house in the USA
    0 Post(s)
    0 Thread(s)

    Sync database structure/data for development

    I have recently started on a project that is being developed for personal and for work related objectives. I have setup an SVN server to sync my project files between my work and home machines where I do my development. My issue now is how to synchronize my MySQL database between the two locations?

    Would it be best to just mysqldump the whole database structure into a .sql file and add that to the SVN?

    I would setup a remote access MySQL server, but my concern is that one location may not have access to the database if the internet connection at either location goes down.
    Daniel - PHP Tutorials and code snippets
    Notepad++ Function List plugin tip - for PHP developers

  2. #2
    SitePoint Enthusiast
    Join Date
    May 2007
    0 Post(s)
    0 Thread(s)
    do not use mysql dump to syn database structure between your working machine and home machine. sometime schema change will mess up whole application.

    my way is incremental syn. that mean you have to do it when your start design your DB schema.

    For example:
    first version : your create a table:

    create mytable (id primary key, name varchar(32)).

    after that ,add this sql file to you SVN. but need to remember after your added the sql file, never modify it . if your find any errors or want add more field to your DB schema, create a new sql file, and use ALTER,DROP to change your schema DB.

    when your want to duplicate DB to new machine, just run all SQL file from number 1 to end.

    when you syn with working and home machine, your only need to run lasted patch .

    hope that help.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts