2

We are working on one legacy framework and it is continuously evolving.

Problem 1 : If somebody want to run the application with latest code then he/she spend lots of time in doing so (like somebody forgets to commit code or commits partial code).

Solution : We started using Jenkins and integrated it with our SVN repository with it. So now we always have working code. We thought, now anyone(especially new developer) can get started with application in very short time.

Problem 2 : Soon we discovered that its not code but changes in database(like adding new table or altering existing table or changes in database bootstrap script) that takes developers time.

My question is, how can I deploy code changes (which currently, I am able to do) as well as database changes (which I don't know how can be done) to some test server using some automation tool like Jenkins.

  • 2
  • 1
    What's the specific question? Just execute whatever steps you need to do to update a test server from Jenkins over SSH (or PS Remoting) instead of manually. – Dan1701 Mar 14 '17 at 16:08
2

The approach that seems to be the most common is to create a table in the database which keeps track of the version of a schema and reference data. This version is not to be confused with the version of the DBMS. Then you create scripts which incrementally modify the schema and update that table. Getting from version a to version c a matter of running the scripts for b then c which can be automated fairly easily.

I would also advise that you add checks in your code that verify the schema version on startup and fail-fast if it is not in-sync.

There are tools such as flyway that implement this strategy and you should look at them before embarking on creating something yourself.

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.