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

          --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

          --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

  • I think you have same value in a row but different Id in employee table in beta and master database server. – vijayp Sep 26 '14 at 6:33
  • yes right one same row would have different values on master and different value for beta – user310685 Sep 26 '14 at 6:40
  • @vijayp any suggestion please – user310685 Sep 26 '14 at 9:15

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.

  • means is it like having to separate log files lets say 20140926-master.sql and 20140926-beta.sql and deploy respected file on respected DB server – user310685 Sep 26 '14 at 13:31
  • No, I mean github commits for the same file, For code push, you can choose 1 commit for beta and 1 commit for master, use merge the get these respective changes in each branch – vijayp Sep 26 '14 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.