Mysql – different log file for master and beta thesql

database-designlogMySQL

Hi i am facing a problem while shipping my database log

I have three database server dev, beta and master
and i maintain log files for dev on github
and every log file has a version given to it like (001 next would be 002 and so on)
and then i would merge my code on github from dev branch to beta branch , clone the code on beta deploy server run this log files on beta while deploying its build(then while deploying it checks for last updated .sql file and start deploying from next file), test it and if all ok
then again
i would merge my code on github from beta branch to master branch, clone the code on master deploy server run this log files on master while deploying its build, test it and if all ok
that would be my final release
sample log file

          20140926.sql
          --add a stored procedure
          --update employee where id=10;
          --alter table .etc    

but now i am facing a problem in this
i have a table called as employee
and on this i need to have different changes
like example

          20140926.sql
          --update employee set name="beta" where id=10;--this should go in beta database only BUT NOT IN MASTER
          --update employee set name="master" where id=10;--this should go in MASTER database only BUT NOT IN BETA
          --update sometable set something='somevalue' where nothing='nothing';--but his update is common for both BETA and MASTER branch

but if now i commit it on dev and merge to beta and deploy on beta this the changes which should go ONLY on MASTER are going on BETA
and this is totally screwing my whole exsisting logic

Best Answer

I see one solution to this situation is to have multiple commit of the same file.

let say 20140926.sql file in this case, Now you have two changes one should go to Beta server and one to Master server.

You can have two seperate commit, changes that suppose to go to Beta in one commit and changes that is suppose to Master in other commit, with proper comment to indentify and versions incrementing count too can help.

Now while merge in Beta branch you can get the only version of commited for it and in Master the other corresponding version commited for it.