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
  • 7,235
  • 9
  • 46
  • 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,546
  • 1
  • 21
  • 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,727
  • 1
  • 25
  • 32