Database Update Tool

Hello everyone,

I found that trinitycore has many sql updates coming every other day which requires me to remember which updates I applied before, and to apply all the new ones whihc might be quite a few.

So I created a java application to help me with this task: DBUpdater

You give it your database information and the location of the sql updates.

It will then print a list of updates it found and aks for the first and the last update to apply.

Then it applies them all one by one and exits when it encounters an error.

The source is located at github.

The code is released under the MIT License.

Technical details ( How is it done?)

Basically I am reading the content of the given folder finding all .sql files. I then sort them by the timestamps in their names and ask the user for the first and last updates.

Then, I have a simple class that calls the commandline mysql client available in the PATH to execute each script.

a GUI is planned to be done but god knows if I will ever do one.

I have also been working on using jdbc to execute the queries but there is still an issue with special characters such as ‘$’ that cause jdbc to bark, and the SQLScritpReader class might modify strings in sql queries.

I hope you will find this a useful tool and that it eases your updating processes.

UPDATE: v0.2 is out!

  • I have written a parser that actually works to read the sql udpates query by query

  • The code is using jdbc and the mysql bridge to execute the queries

Download here: DBUpdater.zip

I like the idea. +1

BUMP to honor the release of v0.2. Actually I just want some attention xD

Hmm, I think it would be more useful if it would run all queries on the first time for example (or you could config this or w/e)
But after that it would remember what was the last SQL’s name for example or the date you ran the queries and then next time you run it, it would run the new ones.
Otherwise atm its just the same as you would normally execute SQLs pretty much … can just merge them with a bat or something and run them. upon error you can fix the error anyways and continue.

I use a script i wrote on my mac … it stores the executed sql file names to a mysql database and use them to find the next update file. Its only working with the MySQL path “$HOME/Applications/trinityserver/mysql/bin/mysql” from my mac osx tutorial.

https://github.com/jeremymeile/jeremymeile/blob/master/TDBtool.sh

http://www.jeremymeile.ch/files/screen-shot-2013-10-21-at-9.07.44-pm.png