0

I am doing an ongoing MySQL database development. I have a create database script and a set of scripts to patch it along the time. In those patch I need to check if the target database is the correct version. I am thinking to add a table to my schema for this purpose but it might overkill this problem.

I am wondering what is the best practice to do it.

THanks,

Frank
  • 6,637
  • 9
  • 44
  • 56

2 Answers2

0

I am using maven plugin for that. It can track your database changes as well as apply missing SQL scripts.

https://github.com/m-szalik/dbpatch-maven-plugin

m-szalik
  • 3,398
  • 1
  • 19
  • 28
0

That is what I do for a number of databases - a table called schema_history, that my scripts which update the schema always add a row to: with date, version ID, purpose, etc. I can see what version any database is by looking at the last record in schema_history -- very handy.

I recommend this approach.

D Mac
  • 3,609
  • 1
  • 22
  • 32