Version control (SVN) of MySQL database in WordPress theme development (any code examples?)

*We deployed an SVN server on Dropbox(!)
and everything works fine,
but I’m looking for an easy tutorial

QUESTION #1: how to version control WordPress database
for the theme development
with several developers

Read More

Main tasks:

  • Stability
  • Easy to update
  • Branch, merge, diff conflicts

I’ve searched a lot of similar topics,

  • but many of them just give an overview, not tutorials for dummies
  • very few of them show how to code those scripts exactly.

So here are results of three days of research – almost 20 hours(!)

QUESTION #2: The scripts (below) are enough for given tasks (above)? or I need to…

  • I need to check triggers, views and strip them (how?)
  • This code provides DDL separation (schema and data includes)?
  • Is is stable in the long run?

update.bat

if exist TortoiseProc.exe goto work1
exit

:work1
rem call D:xampp-themesmysql_stop.bat
rem ping 192.0.2.2 -n 1 -w 3000 > nul
START TortoiseProc.exe /command:update /path:"D:xampp-themeshtdocsthemeswp-contentthemestheme1"
rem call D:xampp-themesmysql_start.bat
pause
if exist d:xampp-themesmysqlbinmysql.exe goto work2
exit

:work2
d:xampp-themesmysqlbinmysql.exe -u root --default-character-set=utf8 wordpress<"d:xampp-themeshtdocsthemeswp-contentthemestheme1dbcreation.sql"
d:xampp-themesmysqlbinmysql.exe -u root -D --default-character-set=utf8 wordpress<"d:xampp-themeshtdocsthemeswp-contentthemestheme1dbase_data.sql"
rem call D:xampp-themesmysql_stop.bat

rem ping 192.0.2.2 -n 1 -w 3000 > nul
rem exit
pause

commit.bat

if exist d:xampp-themesmysqlbinmysqldump.exe goto work1
exit

:work1
d:xampp-themesmysqlbinmysqldump.exe -u root --default-character-set=utf8 wordpress>"d:xampp-themeshtdocsthemeswp-contentthemestheme1dbase_data.sql"
d:xampp-themesmysqlbinmysqldump.exe -u root -d --default-character-set=utf8 wordpress>"d:xampp-themeshtdocsthemeswp-contentthemestheme1dbase_structure.sql"
call D:xampp-themesmysql_stop.bat
rem ping 192.0.2.2 -n 1 -w 3000 > nul

if exist TortoiseProc.exe goto work2
exit

:work2
START TortoiseProc.exe /command:commit /path:"D:xampp-themesmysqldata"
START TortoiseProc.exe /command:commit /path:"D:xampp-themeshtdocsthemeswp-contentthemestheme1"
pause
call D:xampp-themesmysql_start.bat
rem exit

All shown above can be pretty lame, but anyway:


Could you suggest a better aproach?

Specs:

  • Dropbox as a server on Windows environment (not bash/linux syntax)
  • Vanilla WordPress 3.5.1
  • XAMPP
  • SVN or Subversion with TortoiseSVN Windows client

Please, provide / edit code! Thanks in advance!

Related posts

Leave a Reply

1 comment

  1. Main steps:

    1. Simplicity. Don’t use TortoiseProc, use CLI-client
    2. Stability. Don’t use Dropbox as repository (or WC) media, select SVN-hosting for your needs
    3. Usability. Read about Luqibase as DB-versioning and refactoring engine and start using it, adopt workflow for needed changes