PDA

View Full Version : Thought for DB/Server Update Tracking


Shendare
07-27-2015, 07:22 PM
How difficult would it be for those who add a required .sql update to put an extra insert into a dbupdates table at the end so that it's dead simple for scripts to know what version of the database the server's on?

required/pretend_items_update_2015-07-26.sql

ALTER TABLE `items` ADD COLUMN `augmentslot19`NOT NULL DEFAULT 0;

INSERT INTO `db_updates` (`id`, `date`, `desc`) VALUES (null, '7/26/2015', 'pretend items update');


Any script wanting to update the database to a newer version could:


SELECT * FROM `db_updates` WHERE `date`=(SELECT MAX(`date`) FROM `db_updates`);


The script doing the querying would get the most recent date that updates where applied, and which updates were applied on that day, in case there were multiples and not all were applied last time.

In the same vein, perhaps an addition could be made to world.exe in which passing an argument like --version would cause it to return its build date to STDOUT for a script to read. It could then make sure the database has all required (and optional) updates up through that date, instead of using the current date, in case the server's codebase is lagging behind.

Just some random thoughts to complement Akka's handy new auto-patcher to maybe alleviate some of the headache with making sure all required patches are applied.

Kingly_Krab
07-27-2015, 07:36 PM
I think it's a better idea to do it the current way. My reasoning being this, there are people who could somehow apply newer patches without the older ones, which would cause issues, that's why Akkadius' script checks each and every SQL.

rhyotte
07-27-2015, 07:38 PM
Tagging in.

Akkadius
07-27-2015, 07:54 PM
I really don't understand what you're trying to solve that isn't already taken care of.

Akkadius
07-27-2015, 07:58 PM
If you're confused as to how the current system works, consult:

http://wiki.eqemulator.org/p?Automatic_Database_Upgrade_System

Shendare
07-27-2015, 08:08 PM
Oh, wow, yeah, you've got it all taken care of, Akka. Had no idea you were tracking so much in a manifest and common/version.h.

Ignore this thread. Akka's got things -very- well in hand!

Akkadius
07-27-2015, 08:39 PM
Lol!

Yeah everything before it was a mess, 10+ threads a week on support issues related to missing database updates.

I think it's a pretty solid system IMO and has made things quite smooth for both users and developers

N0ctrnl
07-27-2015, 10:48 PM
With a little manual work, it's easy to bring up just about any database to the current schema too. The update tool is a work of art.

Akkadius
07-27-2015, 11:06 PM
With a little manual work, it's easy to bring up just about any database to the current schema too. The update tool is a work of art.

Thank you N0ctrnl, I spent quite a bit of time on it.

The only thing that could be done with it is actually backport the db manifest through all of the SVN updates. That's the only thing that I've not taken the time to do, which currently it would only keep someone from smoothly updating a 4+ year old database.

N0ctrnl
07-28-2015, 12:03 AM
I've tried that very thing a few times before running out of steam on it. I find it really interesting to compare older versions and see what kind of gems can be found in some of the classic zones.

Akkadius
07-28-2015, 12:22 AM
I've tried that very thing a few times before running out of steam on it. I find it really interesting to compare older versions and see what kind of gems can be found in some of the classic zones.

Yeah I'll have to get it knocked out sometime